[Haskell-cafe] memorize function with number parameterized types in GHC

Ivan Lazar Miljenovic ivan.miljenovic at gmail.com
Mon Nov 7 07:27:02 CET 2011

On 7 November 2011 16:54, Bin Jin <bjin1990 at gmail.com> wrote:
> The actual time to calculate p2num and montgKeys are both O(log P). What I'm
> looking is a constant time lookup.

Are these two functions CPU bottlenecks as revealed by profiling?  If
not, then you're probably over-optimising.

Note that if O(1) lookup is really required, then that implies you use
a static array, which requires you to pre-populate such an array with
all possible values.

Ivan Lazar Miljenovic
Ivan.Miljenovic at gmail.com

More information about the Haskell-Cafe mailing list