[Request for comments] Potential room for speedup when calculating divmod() of bases with many trailing 0 bits (in binary)

Shlomi Fish shlomif at gmail.com
Wed Sep 23 07:05:31 UTC 2020


Hi all!

>
> > You should try to write more concise benchmarks (someone also asked for
> > more concise e-mails :-)
> >
>
> I'll see what I can do.

Hopefully this cleaned up benchmark code will  be adequate:

https://github.com/shlomif/shift_divmod/blob/4f4b806521ff13acf5897c165660cfe08b419ed7/gmp-shift_divmod/pure_gmp_benchmark.c

The results are similar to the previous ones:

```
~/progs/python/shift_divmod/gmp-shift_divmod/ time pypy3
../python-shift_divmod/code/examples/shift_divmod_example.py
gen_shift_mod
{'val': 5206685, 'time': 23.43782687187195, 'reached': 1000,
'interrupted': False, 'mode': 'gen_shift_mod'}
pypy3 ../python-shift_divmod/code/examples/shift_divmod_example.py
23.35s user 0.04s system 99% cpu 23.495 total

~/progs/python/shift_divmod/gmp-shift_divmod/ (export
LD_LIBRARY_PATH=/home/shlomif/apps/gmp/lib/ ; time
./pure-gmp-bench.exe)
result = 5206685
./pure-gmp-bench.exe  29.09s user 0.01s system 99% cpu 29.161 total


```

Thanks for your help.
-- 
Shlomi Fish https://www.shlomifish.org/

Buddha has the Chuck Norris nature.

Please reply to list if it's a mailing list post - http://shlom.in/reply .


More information about the gmp-discuss mailing list