Closed reidfaiv closed 7 years ago
Thanks for the report. Actually, the explanation is given just after the example when I try to explain the gain come from the generation of all the steps at once. I will modify text to remove the confusion.
Also, I removed the choices
function (in favor of sample
) because it is only for Python 3.6.
In chapter "2.1 Simple example" you have example of "Vectorized approach" which leaves impression that most performance benefits come from itertools.accumulate(). This is not true - the main speed gain comes from use of random.choices() instead of random.randint() in previous sample.
It is clearly visible that accumulate has minor effect on overall speed (which is mainly driven by itertools() native implementation).
As such example is clearly misleading.
Another minor bug with example: random_walk() returns N+1 elements while random_walk_faster() returns N elements.