Overview
| Artifact ID: | a3976ebde65e571fc755846606ba8856a66eac31 |
|---|---|
| Ticket: | 1767293fffffffffffffffffffffffffffffffff
Bad performance using ** operator with integer operands |
| User & Date: | kennykb on 2007-08-07 05:20:00 |
Changes
- icomment:
File Added - 240154: power.patch Logged In: YES user_id=99768 Originator: NO The attached patch is working toward a solution. Observation #1: Powers of 2 are the same as shifts of 1, and are handled thus. Observation #2: For 32-bit integers, a very efficient exponent can be computed by doing special-case straight-line code for raising to powers 3-8, and then using table lookups for higher powers (up to 3**19 and up to 10**10). Observation #3: For 64-bit integers, a similar computation can be done with straight-line code for raising to powers 3-16, and then table lookup for higher powers (up to 3**39 and up to 14**17). I haven't tried to implement #3, because I'm none too certain how to initialize Tcl_WideInts at compile time with values that don't fit in an int. The patch should be commitable as it stands (resulting in performance gains only on 32-bit machines), but obviously #3 is important, too. File Added: power.patch
- login: "kennykb"
- mimetype: "text/plain"
- username: "kennykb"