This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients georg.brandl, ldeller, vstinner
Date 2008-10-03.12:16:17
SpamBayes Score 6.2179055e-07
Marked as misclassified No
Message-id <1223036194.02.0.978394197478.issue4024@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2008-10-03 12:16:34vstinnersetrecipients: + vstinner, georg.brandl, ldeller
2008-10-03 12:16:34vstinnersetmessageid: <1223036194.02.0.978394197478.issue4024@psf.upfronthosting.co.za>
2008-10-03 12:16:19vstinnerlinkissue4024 messages
2008-10-03 12:16:18vstinnercreate