Facundo Batista wrote: > Mark Dickinson found out that a lot of time was lost internally in > decimal.py when dealing with the Decimal mantissas. > > He changed the way that mantissa was stored, from a tuple of ints, to > a plain string (each character a digit). This achieved a speedup of > around a 40%!!!
Given the frequent conversion to and from long integers needed to actually do the calculations, I can actually see how that would be the case. Excellent news. Did you change the Decimal repr to use the same format for the mantissa? > > Three notes: > > - The speedup was measured using two tools I created [*], one > basically tries a lot of use cases, the other use the specification > test cases. Both generate a .py which actually measures the times. Could you also check the performance gain against the telco benchmark which is in the sandbox? [1] The 10-number file is checked into svn along with the test script, and the million-number file is available from Cowlishaw's decimal site [2]. Cheers, Nick. [1] http://svn.python.org/projects/sandbox/trunk/decimal/telco/ [2] http://www2.hursley.ibm.com/decimal/telco.html -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --------------------------------------------------------------- http://www.boredomandlaziness.org _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com