[issue39434] Add float __floordiv__ fast path

2020-01-23 Thread Dong-hee Na
Dong-hee Na added the comment: @mark.dickinson I extract the common function. Now maintainence cost is same as AS-IS. optimization is still work :) AS-IS: Mean +- std dev: 360 ns +- 19 ns TO-BE: Mean +- std dev: 185 ns +- 8 ns what do you think? --

[issue39434] Add float __floordiv__ fast path

2020-01-23 Thread Dong-hee Na
Dong-hee Na added the comment: > (e.g., because someone decides to "fix" the floor float division) Okay, what if we create a common divmod function except for creating a tuple? -- ___ Python tracker ___

[issue39434] Add float __floordiv__ fast path

2020-01-23 Thread Mark Dickinson
Mark Dickinson added the comment: So the risk here is that by adding the floordiv fast path, the division code is duplicated, and that increases the risk of accidentally losing the invariant that `a // b` is interchangeable with `divmod(a, b)[0]` (e.g., because someone decides to "fix" the f

[issue39434] Add float __floordiv__ fast path

2020-01-23 Thread Dong-hee Na
Dong-hee Na added the comment: And on the other side, >>> 3.8 // 0.0 Traceback (most recent call last): File "", line 1, in ZeroDivisionError: float divmod() I think that people expect ZeroDivisionError: float floor division by zero not the current message. I caught this optimization iss

[issue39434] Add float __floordiv__ fast path

2020-01-23 Thread Dong-hee Na
Dong-hee Na added the comment: > Is this worth optimizing? Floating-point floor division is a comparatively > rare operation. 1. I don't want to say that this should always be optimized. 2. However, this operation is a relatively primitive python operation. I think this optimization is easy

[issue39434] Add float __floordiv__ fast path

2020-01-23 Thread Mark Dickinson
Mark Dickinson added the comment: Is this worth optimising? Floating-point floor division is a comparatively rare operation. -- nosy: +mark.dickinson ___ Python tracker ___ _

[issue39434] Add float __floordiv__ fast path

2020-01-23 Thread Dong-hee Na
Change by Dong-hee Na : -- keywords: +patch pull_requests: +17533 stage: -> patch review pull_request: https://github.com/python/cpython/pull/18147 ___ Python tracker ___

[issue39434] Add float __floordiv__ fast path

2020-01-23 Thread Dong-hee Na
Change by Dong-hee Na : -- type: -> performance ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail

[issue39434] Add float __floordiv__ fast path

2020-01-23 Thread Dong-hee Na
New submission from Dong-hee Na : ./python.exe -m pyperf timeit "a = 3.5" "b = a // 2" AS-IS: Mean +- std dev: 377 ns +- 4 ns my patch: Mean +- std dev: 204 ns +- 2 ns -- assignee: corona10 messages: 360559 nosy: corona10 priority: normal severity: normal status: open title: Add float _