My measurements show that<div><br><div>- using strict version of insertWith doesn&#39;t improve performance. <div>- in case of compilation with -O2 flag foldl&#39; also is equal to foldl (-O2 gives approx 2 time impovements).<div>
- using RandomGen and State monad to generate a list gives at least 4 times improvements (on 1 000 000 items). </div><div><br></div><div>More complicated improvements (using Array, PRNG and so on) were not tested by me.</div>
</div></div></div>