Ticket UUID: | 1301707 | |||
Title: | TIP 237 compatibility patch | |||
Type: | Bug | Version: | None | |
Submitter: | dgp | Created on: | 2005-09-23 17:57:39 | |
Subsystem: | sha1 | Assigned To: | patthoyts | |
Priority: | 8 | Severity: | ||
Status: | Closed | Last Modified: | 2005-10-01 05:32:48 | |
Resolution: | Accepted | Closed By: | andreas_kupries | |
Closed on: | 2005-09-30 22:12:44 | |||
Description: |
TIP 237 proposes for Tcl integer computations to support an unlimited integer range. The sha1 package does its computations assuming a fixed-size buffer of at least 32-bits. Doing unlimited range calculations won't exactly be wrong, but it will mean computing with truly enormous numbers, spending an ever-increasing amount of time, only to throw away all but the lowest 32-bits. Better to use the int(.) function to explicitly but the modular nature of the calculation in place. Here's a patch. | |||
User Comments: |
nobody added on 2005-10-01 05:32:48:
Logged In: NO Adding some extra ops to truncate seems to make it a bit slower with both 8.4 and the current 8.5 head. Using int() or &0xffffffff seem to be equally slow. I'm going to rig it to switch on the interpreter version and try and get the fastest implementation that will remain correct. andreas_kupries added on 2005-10-01 05:12:44: Logged In: YES user_id=75003 Applied to head. dgp added on 2005-09-27 08:47:22: Logged In: YES user_id=80530 After TIP 237, you do not want to allow the computed numbers to grow without bound. Whether you limit them to 32-bits or 64-bits doesn't really matter, IMHO. (That's why I suggest int(.) as the fix, without regard to what length that means) At either range you'll stick to computation that can be done with native types, either long or Tcl_WideInt. But without some limit, pretty soon you're chugging away on values literally thousands of digits long, just to keep the last 10 or so. The small test suite literally runs for hours. Dunno about performace cost to 8.4 and earlier. It's something that can be dealt with if needed though. andreas_kupries added on 2005-09-27 05:29:33: Logged In: YES user_id=75003 However internal results can still be larger than int, right ? Should we care ? How much performance do we lose for pre-8.5 Tcl because of the additional conversions ? dgp added on 2005-09-24 00:57:40: File Added - 150148: sha1.patch |
Attachments:
- sha1.patch [download] added by dgp on 2005-09-24 00:57:39. [details]