GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — gh-100239: specialize left and right shift ops on ints by eendebakpt · Pull Request #129431 · python/cpython Conversation
|
|
@eendebakpt, something happened with the milestone. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
This PR is stale because it has been open for 30 days with no activity. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
# Conflicts: # Python/specialize.c
|
Updated benchmarks:
Benchmark script"""Microbenchmarks for compact-int shift specialization (gh-100239).""" import pyperf def bench_lshift_compactint(loops): range_it = range(loops) a = 3 t0 = pyperf.perf_counter() for _ in range_it: a << 1; a << 2; a << 3; a << 4; a << 5 a << 1; a << 2; a << 3; a << 4; a << 5 a << 1; a << 2; a << 3; a << 4; a << 5 a << 1; a << 2; a << 3; a << 4; a << 5 return pyperf.perf_counter() - t0 def bench_rshift_compactint(loops): range_it = range(loops) a = 1 << 20 t0 = pyperf.perf_counter() for _ in range_it: a >> 1; a >> 2; a >> 3; a >> 4; a >> 5 a >> 1; a >> 2; a >> 3; a >> 4; a >> 5 a >> 1; a >> 2; a >> 3; a >> 4; a >> 5 a >> 1; a >> 2; a >> 3; a >> 4; a >> 5 return pyperf.perf_counter() - t0 def bench_rshift_largeint(loops): range_it = range(loops) a = 1 << 200 t0 = pyperf.perf_counter() for _ in range_it: a >> 1; a >> 2; a >> 3; a >> 4; a >> 5 a >> 1; a >> 2; a >> 3; a >> 4; a >> 5 a >> 1; a >> 2; a >> 3; a >> 4; a >> 5 a >> 1; a >> 2; a >> 3; a >> 4; a >> 5 return pyperf.perf_counter() - t0 def bench_lshift_loop_var(loops): range_it = range(loops) t0 = pyperf.perf_counter() for _ in range_it: a = 5 for i in range(16): a << i return pyperf.perf_counter() - t0 def bench_rshift_loop_var(loops): range_it = range(loops) t0 = pyperf.perf_counter() for _ in range_it: a = 1 << 16 for i in range(16): a >> i return pyperf.perf_counter() - t0 def bench_inplace_lshift(loops): range_it = range(loops) t0 = pyperf.perf_counter() for _ in range_it: a = 1 a <<= 1; a >>= 1 a <<= 2; a >>= 2 a <<= 3; a >>= 3 a <<= 4; a >>= 4 a <<= 5; a >>= 5 return pyperf.perf_counter() - t0 if __name__ == "__main__": runner = pyperf.Runner() runner.bench_time_func("lshift_compactint", bench_lshift_compactint, inner_loops=20) runner.bench_time_func("rshift_compactint", bench_rshift_compactint, inner_loops=20) runner.bench_time_func("rshift_largeint", bench_rshift_largeint, inner_loops=20) runner.bench_time_func("lshift_loop_var", bench_lshift_loop_var) runner.bench_time_func("rshift_loop_var", bench_rshift_loop_var) runner.bench_time_func("inplace_shift_mix", bench_inplace_lshift, inner_loops=10) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Documentation build overview
9 files changed ·
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
This PR is stale because it has been open for 90 days with no activity. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Reopening. This was incorrectly closed as a duplicate. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.