STINNER Victor <[EMAIL PROTECTED]> added the comment:

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.

----------
nosy: +haypo

_______________________________________
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue4024>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to