Message74244
We need maybe more hardcoded floats. I mean a "cache" of current
float. Example of pseudocode:
def cache_float(value):
return abs(value) in (0.0, 1.0, 2.0)
def create_float(value):
try:
return cache[value]
except KeyError:
obj = float(value)
if cache_value(value):
cache[value] = obj
return obj
Since some (most?) programs don't use float, the cache is created on
demand and not at startup.
Since the goal is speed, only a benchmark can answer to my question
(is Python faster using such cache) ;-) Instead of cache_float(), an
RCU cache might me used. |
|
Date |
User |
Action |
Args |
2008-10-03 12:16:34 | vstinner | set | recipients:
+ vstinner, georg.brandl, ldeller |
2008-10-03 12:16:34 | vstinner | set | messageid: <1223036194.02.0.978394197478.issue4024@psf.upfronthosting.co.za> |
2008-10-03 12:16:19 | vstinner | link | issue4024 messages |
2008-10-03 12:16:18 | vstinner | create | |
|