This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: speed up md5: allow Encode and Decode to inline
Type: Stage:
Components: Extension Modules Versions:
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: Nosy List: donut, loewis
Priority: normal Keywords: patch

Created on 2004-06-21 22:39 by donut, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
python-md5c-Decode+Encode-allow-inlining.patch donut, 2004-06-21 22:39 the patch
Messages (2)
msg46204 - (view) Author: Matthew Mueller (donut) Date: 2004-06-21 22:39
gcc will only inline functions if they are defined
before where they are used.  So this patch just moves
Encode and Decode up to the top of the file.

This can provide a couple percent improvement in speed.
(try
timeit.py -s 'import md5; m=md5.new(); d="a"*64'
'm.update(d);m.digest()'
and
timeit.py -s 'import md5; m=md5.new(); d="a"*0x100000'
'm.update(d)'
)

Decode is only used once, so allowing it to inline
actually reduces the code size, Encode is used twice
but its a pretty small function so it doesn't change
the size much either way..
msg46205 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2004-08-03 13:08
Logged In: YES 
user_id=21627

Thanks for the patch. Applied as md5c.c 2.9.
History
Date User Action Args
2022-04-11 14:56:04adminsetgithub: 40428
2004-06-21 22:39:17donutcreate