gavinhoward / bc

An implementation of the POSIX bc calculator with GNU extensions and dc, moved away from GitHub. Finished, but well-maintained.
https://git.gavinhoward.com/gavin/bc
Other
162 stars 32 forks source link

Small performance optimization (perhaps for the next following release?) #23

Closed stesser closed 5 years ago

stesser commented 5 years ago

Benchmarks show a small but significant speed-up of "make test" if the limit for the shifting of operands is made more strict. Many operands will require a second iteration of the inner loop anyway, and shifting of the operands uses cycles for no gain, then.

To my surprise, BC_BASE_DIGS=4 and =9 seem to have near identical performance after this change. Some operations (multiplication and power) ought to be faster with larger BcDigs, but at least for the performance of "make test" on my system this does not seem to affect the run-time by a significant amount.

gavinhoward commented 5 years ago

I am not planning on future releases, except for bug fixes. I will merge this now.