Let us start our timing experiments with
something simple: how long does it take for a computer to add 1 to (or increment) a number? Replace Hello!
in the timing script with an addition operator from the Operators
menu, and add 1
to 100000
(that's five zeros!). Run the script a few times (around four) to
get an idea of the average approximate time (in seconds) it takes for
the computer to increment 100000
. Run the script repeatedly by double-clicking on it; do not place the script inside a repeat
or a repeat until
block, since we are interested in knowing the approximate time the script takes to run once.
Now, pause here and think: what's your gut
feeling for how much longer the computer would take if we doubled 100000
?
Test your intuition: Get an average approximate time for how long it
takes the computer to increment numbers that you progressively double: 200000
, 400000
, 800000
, and 1600000
.
Remember that for each number, you need to run the timing script
multiple times (around four) to get an idea of the average approximate
time (you don't have to be precise). What do you observe?
Take another huge leap and find out how long
it (approximately) takes for the computer to increment numbers that you
progressively scale by 10: 160000000
, 1600000000
(that's eight zeros), and maybe 16000000000
(that's nine zeros). What do you observe?