Reducing TLU
Last updated
Last updated
This guide teaches how to improve the execution time of Concrete circuits by reducing the amount of table lookups.
Reducing the amount of table lookups is probably the most complicated guide in this section as it's not automated. The idea is to use mathematical properties of operations to reduce the amount of table lookups needed to achieve the result.
One great example is in adding big integers in bitmap representation. Here is the basic implementation:
There are two table lookups within the loop body, one for >>
and one for %
.
This implementation is not optimal though, since the same output can be achieved with just a single table lookup:
It was possible to do this because the original operations had a mathematical equivalence with the optimized operations and optimized operations achieved the same output with less table lookups!
Here is the full code example and some numbers for this optimization:
prints:
which is almost half the amount of table lookups and ~2x less complexity for the same operation!