Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
c6daaccf
Commit
c6daaccf
authored
Mar 15, 2018
by
gabrieldemarmiesse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Corrected a big mistake about speedup.
parent
1105d722
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
docs/src/tutorial/cython_tutorial.rst
docs/src/tutorial/cython_tutorial.rst
+5
-5
No files found.
docs/src/tutorial/cython_tutorial.rst
View file @
c6daaccf
...
...
@@ -270,7 +270,7 @@ It's possible to compare the speed now::
>>> %timeit primes(500)
502 µs ± 2.22 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)
The Cython version is 11
550
times faster than the Python version! What could explain this?
The Cython version is 11 times faster than the Python version! What could explain this?
Multiple things:
* In this program, very little computation happen at each line.
...
...
@@ -281,10 +281,10 @@ Multiple things:
when using Python. Because everything in python is an object, and every object is
implemented as a dictionary, this is not very cache friendly.
It's worth mentioning that you won't usually get speedups like this.
We very likeky touched a sweet spot with the CPU cache. Usually the speedup
s
are between 2x to 1000x. As always, remember to profile before adding types
everywhere
.
Usually the speedups are between 2x to 1000x. It depends on how much you call
the Python interpreter. As always, remember to profile before adding type
s
everywhere. Adding types makes your code less readable, so use them with
moderation
.
Language Details
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment