Skip to content

Dev Notes: 2017_02_11

Dave Hudson edited this page Feb 12, 2017 · 6 revisions

Faster Digit Operations

Our memory allocation overheads dominate, and we'll deal with them shortly, but a quick scan through our profiler data shows that we're spending time in other places too.

The function-level profiling doesn't reveal anything too interesting, but if we look at the individual functions and the profiler annotations (at the assembler level) we can see two areas for immediate improvement:

  • The normalize() operations are generic, but the actual operations required to define the size of a function output rarely require iterations.

  • There are a lot of uses of the digits_ array that can be replaced by using temporary pointers to the digits_ array directly, rather than indirectly.

This last option is a general performance optimization. In general, any time we need a duplicate sub-expression it's much better to do so explicitly, rather than to expect the compiler to find them for us. Even if the compiler does do the right thing, we will never see worse readability or maintainability by explicitly extracting sub-expressions.

See Also

Dev Notes: 2017_02_07

Clone this wiki locally