-
Notifications
You must be signed in to change notification settings - Fork 449
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Chapter 3 code runs slow for me #7
Comments
Marc, The benchmark test doesn't take 1-2 seconds to run, it runs something 100 times and prints the average run time and standard deviation. In this case it times running a sort round that takes 1-2 seconds to run on average. Using Python 3.5, my box sorts 40 numbers in 1.27 seconds on average. That means when I run the benchmark test it takes about 127 seconds to run. Combined, your CPU and Python version run the same test twice as fast. That's why how many numbers you choose to sort is processor dependent. The benchmark test is useful for tracking whether a change to the engine has negatively impacted the speed of the engine. I also find it useful for detecting performance problems in the algorithm code. Clinton |
Hi Clinton,
Thank you for your reply! You explanation was very helpful.
And thanks again for great book! Python is an amazing language and it's
great to learn from such practical applications as you present.
Regards,
Marc
…On Tue, Oct 15, 2019 at 7:01 AM Cℓinton Sheppard ***@***.***> wrote:
Marc,
The benchmark test doesn't take 1-2 seconds to run, it runs something 100
times and prints the average run time and standard deviation. In this case
it times running a sort round that takes 1-2 seconds to run on average.
Using Python 3.5, my box sorts 40 numbers in 1.27 seconds on average. That
means when I run the benchmark test it takes about 127 seconds to run.
Combined, your CPU and Python version run the same test twice as fast.
That's why how many numbers you choose to sort is processor dependent. The
benchmark test is useful for tracking whether a change to the engine has
negatively impacted the speed of the engine. I also find it useful for
detecting performance problems in the algorithm code.
Clinton
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#7?email_source=notifications&email_token=AHT6HXJVRZW5OUTUFYLS7YTQOWWINA5CNFSM4JAVWPX2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEBIPPRQ#issuecomment-542177222>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AHT6HXOWU4G7NXXWUM4SL33QOWWINANCNFSM4JAVWPXQ>
.
|
Hi,
I'm really enjoying your book! I've learned a lot in just the first three chapters.
I've run into an issue however running the chapter 3 code from the book. ( sorted number list ) The benchmark test sorts 40 numbers. I'm running exactly the same code (copied from github) and it takes 63 seconds to complete. Something has to be wrong here. I'm on a Dell Laptop (Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz, 1992 Mhz, 4 Core(s), 8 Logical Processor(s)).
I'm running the same code that in the book it says on page 44: "1-2 seconds to run on average". I know processors vary but this seems extreme.
Is this normal behavior? I'm new to python and benchmarking so would appreciate any clarification.
Thanks,
Marc
The text was updated successfully, but these errors were encountered: