Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 16595

Why is there a large difference between measured time and actual time?

$
0
0

I am playing around with big lists to test a RPi cluster. I am building a list of character strings that I will eventually calculate hashes of to simulate cryptocurrency mining. The code is running on a Raspberry Pi 3B Rev 1.2.

The code to build the list is:

from pympler import asizeofimport itertoolsimport timestart = time.process_time()combos = list(itertools.combinations_with_replacement('abcdefghijlkmnopqrstuvwxyz', 6))stop = time.process_time()print(len(combos), asizeof.asizeof(combos)/1e6, (stop-start))

The results are:

andrew@master:~ $ python mem_test_1.py 736281 70.727904 0.68859771

The problem is that the actual time (using a stopwatch) is closer to 45 sec. This time difference is reproducible when running the code on my M2 macbook (different numbers but still a big discrepancy). I have also tried time.time() and time.perf_counter() with the same results.

Where is all the missing time going and what have I missed?


Viewing all articles
Browse latest Browse all 16595

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>