beyondgrep / ack2

**ack 2 is no longer being maintained. ack 3 is the latest version.**
https://github.com/beyondgrep/ack3/
Other
1.48k stars 140 forks source link

Would there be a speedup if we invoked a `use integer`? #398

Closed petdance closed 10 years ago

petdance commented 11 years ago

Are all our math operations floating point for no reason? Will use integer help speed anything up?

bk2204 commented 10 years ago

I did some tests on the repository for git, and it doesn't seem that "use integer" makes any difference.

Before

../ack2/ack-standalone use 1.79s user 0.12s system 51% cpu 3.713 total ../ack2/ack-standalone use 5.06s user 0.26s system 95% cpu 5.593 total ../ack2/ack-standalone use 1.66s user 0.12s system 47% cpu 3.708 total ../ack2/ack-standalone use 1.60s user 0.11s system 47% cpu 3.613 total ../ack2/ack-standalone use 1.66s user 0.09s system 48% cpu 3.609 total

../ack2/ack-standalone use > /dev/null 1.21s user 0.03s system 99% cpu 1.244 total ../ack2/ack-standalone use > /dev/null 1.15s user 0.03s system 99% cpu 1.179 total ../ack2/ack-standalone use > /dev/null 1.27s user 0.03s system 99% cpu 1.302 total ../ack2/ack-standalone use > /dev/null 1.12s user 0.05s system 99% cpu 1.169 total ../ack2/ack-standalone use > /dev/null 1.06s user 0.04s system 99% cpu 1.101 total

After

../ack2/ack-standalone use 1.60s user 0.12s system 48% cpu 3.582 total ../ack2/ack-standalone use 1.78s user 0.08s system 51% cpu 3.630 total ../ack2/ack-standalone use 1.55s user 0.10s system 45% cpu 3.596 total ../ack2/ack-standalone use 1.66s user 0.11s system 48% cpu 3.621 total ../ack2/ack-standalone use 1.62s user 0.12s system 47% cpu 3.645 total

../ack2/ack-standalone use > /dev/null 1.13s user 0.04s system 99% cpu 1.176 total ../ack2/ack-standalone use > /dev/null 1.14s user 0.02s system 99% cpu 1.164 total ../ack2/ack-standalone use > /dev/null 1.10s user 0.02s system 99% cpu 1.126 total ../ack2/ack-standalone use > /dev/null 1.14s user 0.02s system 99% cpu 1.171 total ../ack2/ack-standalone use > /dev/null 1.20s user 0.02s system 99% cpu 1.228 total

As you can see, the numbers don't indicate any significant change by using "use integer". I think the one five-second time is just an anomaly, so I wouldn't consider it.

petdance commented 10 years ago

Thanks for this. I've put a note in my new DESIGN.md file that tracks these sorts of design decisions.

https://github.com/petdance/ack2/blob/dev/DESIGN.md