| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
know that we deal with exact floats here
|
This microbenchmark import time
def bench():
t = time.perf_counter()
f = 1.0
for i in range(60000):
for j in range(1, 1000):
f = f + j
f = f - j
f = f / j
f = f * j
print(time.perf_counter() - t)
if __name__ == "__main__":
bench()shows even better speedup: old: 6.5 seconds new: 5.5 seconds |
Sorry, something went wrong.
This is user-visible change. So, I believe it deserves a news entry. |
Sorry, something went wrong.
| @@ -0,0 +1,2 @@ | |||
| Speedup ``BINARY_OP_EXTEND`` for exact floats and medium-size integers by up | |||
There was a problem hiding this comment.
Compact ints are an implementation detail and the term medium-size integers has been chosen in news entries in the past for them.
Sorry, something went wrong.
There was a problem hiding this comment.
Thank you Chris!
Sorry, something went wrong.
…he float / compactlong specializations (python#144826)
…he float / compactlong specializations (python#144826)
| Back | FazBrowse Home | New Git URL |
Since we know that we deal with exact floats here.
This is just a small follow-up on #128722 and #128963.
I don't think it deserves a news entry, but I'd happily create it if deemed meaningful enough.
Microbenchmark from @iritkatriel 's PR:
Old:
>>> timeit("for i in range(10000):\n\tb = a+i", number=100000, setup="a = 1.0") 42.05178890001844 >>> timeit("for i in range(10000):\n\tb = i+a", number=100000, setup="a = 1.0") 41.31541720000678New:
>>> timeit("for i in range(10000):\n\tb = a+i", number=100000, setup="a = 1.0") 38.316913699993165 >>> timeit("for i in range(10000):\n\tb = i+a", number=100000, setup="a = 1.0") 38.37592560000485Fastmark results are within the noise 1, the three arithmetic benchmarks @Fidget-Spinner mentioned are a tad faster:
Footnotes
see my gist how I do them ↩