[issue22458] Add fractions benchmark

2016-09-13 Thread STINNER Victor
STINNER Victor added the comment: The issue is not closed, but moved to https://github.com/python/performance/pull/10 Please continue the discussion there. I'm now slowly trying to move benchmark issues to GitHub. -- resolution: -> third party status: open -> closed

[issue22458] Add fractions benchmark

2016-09-02 Thread Stefan Krah
Stefan Krah added the comment: Which Stefan? :) Anyway, the first half of this issue was centered around the proposition that fractions are a "better decimal", and the latest pull request still has the "decimal backend" in it. :) Fast fractions have been around for a long time (Lisp/sbcl),

[issue22458] Add fractions benchmark

2016-09-02 Thread STINNER Victor
STINNER Victor added the comment: Stefan Krah added the comment: > Fractions will shine in most benchmarks where decimal is exact anyway. According to Stefan's latest message, the purpose of the benchmark is not the compare decimal to fractions, but measure the performance of fractions for one

[issue22458] Add fractions benchmark

2016-09-02 Thread Stefan Krah
Stefan Krah added the comment: The reason is that the benchmark is a softball for fractions. Using the fastest fraction implementation (gmpy.mpq) and the best printing method for both types, gmpy.mpq seems to be about 2.5 to 3 times slower than decimal. It is however easy to generate

[issue22458] Add fractions benchmark

2016-09-02 Thread Stefan Behnel
Stefan Behnel added the comment: > So this benchmark cannot be used to show the superiority of exact fractions. I don't see how a benchmark would be a way to show that. It's certainly not the goal of this benchmark to show that one is computationally better than the other. But if a benchmark

[issue22458] Add fractions benchmark

2016-09-02 Thread Stefan Krah
Stefan Krah added the comment: I've left comments on GitHub. [scoder] > As I said, where ever exact calculations are needed.. Even if the formatting comment is addressed, the main problem with this benchmark is that *both* fraction and decimal calculations are in fact exact here. You can

[issue22458] Add fractions benchmark

2016-09-01 Thread STINNER Victor
STINNER Victor added the comment: @Stefan Krah: Please review the pull request. https://github.com/python/performance/pull/10 I suggested to only run the benchmark with the fractions module. I don't see the point of running the benchmark with the decimal module. --

[issue22458] Add fractions benchmark

2016-09-01 Thread Stefan Krah
Stefan Krah added the comment: I'm also not opposed to adding it (-0.000) as long as we rename it to bm_fractions.py and change the docstring to "based on the telco benchmark". -- ___ Python tracker

[issue22458] Add fractions benchmark

2016-09-01 Thread STINNER Victor
STINNER Victor added the comment: > I think string conversion should be part of this benchmark, or it should be > renamed to fraction-arith or something. The "telco" benchmark seems to be standard and well defined. I agree that we should use a different name. > That said, is the purpose of

[issue22458] Add fractions benchmark

2016-09-01 Thread Stefan Krah
Stefan Krah added the comment: I think string conversion should be part of this benchmark, or it should be renamed to fraction-arith or something. The formatting function can be a significant bottleneck, and if you use Fractions for financial calculations the result will still need to be

[issue22458] Add fractions benchmark

2016-09-01 Thread Stefan Behnel
Stefan Behnel added the comment: Done: https://github.com/python/performance/pull/10 Note that I didn't replace the existing telco benchmark as it is more specific to Decimal. The new benchmark makes it possible to compare the decimal and fractions modules for similar operations, though.

[issue22458] Add fractions benchmark

2016-08-30 Thread Mark Dickinson
Changes by Mark Dickinson : -- nosy: -mark.dickinson ___ Python tracker ___ ___

[issue22458] Add fractions benchmark

2016-08-30 Thread STINNER Victor
STINNER Victor added the comment: Can you please send a pull request to the new https://github.com/python/performance project? -- nosy: +haypo ___ Python tracker

[issue22458] Add fractions benchmark

2014-10-14 Thread Stefan Krah
Changes by Stefan Krah stefan-use...@bytereef.org: -- nosy: -skrah ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22458 ___ ___ Python-bugs-list

[issue22458] Add fractions benchmark

2014-09-22 Thread Stefan Behnel
New submission from Stefan Behnel: Fractions are great for all sorts of exact computations (including money/currency calculations), but are quite slow due to the need for normalisation at instantiation time. I adapted the existing telco benchmark to use Fraction instead of Decimal to make

[issue22458] Add fractions benchmark

2014-09-22 Thread Mark Dickinson
Changes by Mark Dickinson dicki...@gmail.com: -- nosy: +mark.dickinson ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22458 ___ ___

[issue22458] Add fractions benchmark

2014-09-22 Thread Stefan Behnel
Stefan Behnel added the comment: I just thought that it might also be nice to have a direct comparison with Decimal, so here's an updated benchmark that has an option --use-decimal to run the same code with Decimal instead of Fraction. Decimal is about 66x faster with Py3.4 on my side (due to

[issue22458] Add fractions benchmark

2014-09-22 Thread Antoine Pitrou
Antoine Pitrou added the comment: Where are Fractions used in the real world? -- nosy: +pitrou, skrah ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22458 ___

[issue22458] Add fractions benchmark

2014-09-22 Thread Stefan Behnel
Stefan Behnel added the comment: As I said, where ever exact calculations are needed. I use them for currency calculations, for example, as they inherently avoid rounding errors during the calculations regardless of the relative size of values. They are basically like Decimal but with

[issue22458] Add fractions benchmark

2014-09-22 Thread Antoine Pitrou
Antoine Pitrou added the comment: Le 22/09/2014 14:51, Stefan Behnel a écrit : I use them for currency calculations, for example, as they inherently avoid rounding errors during the calculations regardless of the relative size of values. Do other people use them for that purpose, or are

[issue22458] Add fractions benchmark

2014-09-22 Thread Stefan Behnel
Stefan Behnel added the comment: I admit that I keep meeting developers who are not aware of their merits, simply because many other programming languages don't have them available. Specifically, many developers with a Java background firmly believe that BigDecimal is the only way to do money

[issue22458] Add fractions benchmark

2014-09-22 Thread Antoine Pitrou
Antoine Pitrou added the comment: My point is that if fractions are little used right now, there's little point in adding a benchmark about them in the official benchmark suite. The benchmark suite does not aim at measuring every possible aspect of Python performance, but at showcasing

[issue22458] Add fractions benchmark

2014-09-22 Thread Mark Dickinson
Mark Dickinson added the comment: I've always viewed the `Fraction` type as more of a teaching tool than something intended for real-world calculations. If that's not how others see it, then it might be worth investing some effort in reimplementing `Fractions.gcd` in C: the `Fraction` type

[issue22458] Add fractions benchmark

2014-09-22 Thread Stefan Behnel
Stefan Behnel added the comment: Speed improvements for fractions should have their own ticket(s). I created issue 22464 for this. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22458 ___

[issue22458] Add fractions benchmark

2014-09-22 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Where are Fractions used in the real world? For example Andrew Svetlov uses them in his online game [1]. May be it will explain this in detail. [1] http://asvetlov.blogspot.com/2012/08/numerics.html (on Russian). -- nosy: +asvetlov,