| Ticket UUID: | 850245 | |||
| Title: | Performance blow under md5 2 | |||
| Type: | Bug | Version: | None | |
| Submitter: | hgiese | Created on: | 2003-11-27 13:26:42 | |
| Subsystem: | md5 | Assigned To: | patthoyts | |
| Priority: | 5 Medium | Severity: | ||
| Status: | Closed | Last Modified: | 2004-04-01 06:27:35 | |
| Resolution: | Out of Date | Closed By: | patthoyts | |
| Closed on: | 2004-03-31 23:27:35 | |||
| Description: |
Hello out there,
I got informed that one of my applications barely
crawls under 8.4.5 and traced it back to the md5
package. The script below shows it. The resulting
timing is (Win98 on a 1,3 GHz machine):
Version: 8.4.4
md5 needed 1 ms for a string of 1000 chars
md5 needed 1 ms for a string of 10000 chars
md5 needed 4 ms for a string of 100000 chars
md5 needed 42 ms for a string of 1000000 chars
md5 needed 400 ms for a string of 10000000 chars
Version: 8.4.5
md5 needed 12 ms for a string of 1000 chars
md5 needed 62 ms for a string of 10000 chars
md5 needed 601 ms for a string of 100000 chars
md5 needed 6005 ms for a string of 1000000 chars
md5 needed 60086 ms for a string of 10000000 chars
-----
package require md5
proc tstMD5 {str} {
set start [clock clicks -millisecond]
set cks [md5::md5 $str]
set end [clock clicks -millisecond]
return [expr {$end - $start}]
}
set l "0123456789"
# l1000 is a string containing 1000 chars
set l1000 [string repeat $l 100]
puts "Version: [info patchlevel]"
set i 0
set str $l1000
while { $i < 5 } {
set time [tstMD5 $str]
puts "md5 needed [format %6d $time] ms for a string
of [format %8d [string length $str]] chars"
set str [string repeat $str 10]
incr i
}
------
Best regards
Helmut Giese
| |||
| User Comments: |
patthoyts added on 2003-11-28 06:06:45:
Logged In: YES
user_id=202636
The quick solution to this problem is to require md5 1 which
provides the same support as previous tcllib distributions.
Version 2 has a different API and is more akin to the C API
provided by OpenSSL and the RFC reference implementation.
This allows for incremental updates to the hash, for example:
set hash [md5::MD5Init]
while {$accessing_data_in_chunks} {
md5::MD5Update $hash $data
}
set result [md5::MD5Final $hash]
Unfortunately a bug in Trf means that it can't be coerced
into performing this way (at least not when I last checked
this). There is a critcl based implementation but this isn't
created by the current installation procedure.
Needs sorting out. You can create a compiled module with
cd src/tcllib
./sak.tcl critcl md5c
and then copy the modules/md5c dirctory into your installed
tcllib1.5 tree.
hobbs added on 2003-11-28 00:59:54: Logged In: YES user_id=72656 This has nothing to do with Tcl and everything to do with the changes to md5 v2 where Trf isn't used by default. | |||
Home
Blog
Docs
Downloads
Tickets
Timeline
Branches
Tags
Wiki