Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
707483fd
Commit
707483fd
authored
Mar 26, 2004
by
Raymond Hettinger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update timeit example to reflect current performance.
parent
4b49823e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
Doc/tut/tut.tex
Doc/tut/tut.tex
+3
-3
No files found.
Doc/tut/tut.tex
View file @
707483fd
...
...
@@ -4634,14 +4634,14 @@ immediately.
For example, it may be tempting to use the tuple packing and unpacking
feature instead of the traditional approach to swapping arguments.
The
\ulink
{
\module
{
timeit
}}{
..
/
lib
/
module
-
timeit.html
}
module
quickly demonstrates
that the traditional approach is faster
:
quickly demonstrates
a modest performance advantage
:
\begin
{
verbatim
}
>>> from timeit import Timer
>>> Timer
(
't
=
a; a
=
b; b
=
t', 'a
=
1
; b
=
2
'
)
.timeit
()
0
.
60864915603680925
0
.
57535828626024577
>>> Timer
(
'a,b
=
b,a', 'a
=
1
; b
=
2
'
)
.timeit
()
0
.
8625194857439773
0
.
54962537085770791
\end
{
verbatim
}
In contrast to
\module
{
timeit
}
's fine level of granularity, the
...
...
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