<div dir="ltr">Reading the issue and the benchmarks, it seems like the right call here might be to make the "throws error" version the one that defers the failure check, and to use a similar algorithm for update (which must search to the leaf in any case).  So (!) uses the new algorithm, as do alterF and family.  lookup, member, and findWithDefault retain the old algorithm.<div><br></div><div>That does leave an opening for an expected-to-hit lookup that can still miss.  I'd suggest having an alternative only to lookup, rather than repeating the whole suite of lookup-, member-, and find-like things.</div><div><br></div><div>It looks like the benchmarks are manipulating quite large IntMaps?  I wonder how things look for smaller, shallower maps where fail-late tends to dominate.  I use maps-with-miss all the time, but seldom with (say) millions of elements.</div><div><br></div><div>-Jan-Willem Maessen</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Aug 16, 2021 at 8:12 AM Callan McGill <<a href="mailto:callan.mcgill@gmail.com">callan.mcgill@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div><div>Hi all,<br><br></div>I recently noticed that lookup for IntMap favours searches that can fast-fail - if instead we are in a situation where lookups are mostly successful, then this can be wasteful (see this issue for details: <a href="https://github.com/haskell/containers/issues/794" target="_blank">https://github.com/haskell/containers/issues/794</a>). Since both versions are useful, it would be best to offer users both variants. <br><br>I wondered if people on this list had any suggestions for a name for the new function?  David Feuer also wondered which of these two behaviours should be the default. My inclination is for it to be the current version which fails faster (this also guarantees no unfortunate regressions) but it would be useful to run more substantial real-world benchmarks to figure that out (if anyone has any suggestions then do let me know).<br><br></div>Best wishes,<br></div>Callan<br></div>
_______________________________________________<br>
Libraries mailing list<br>
<a href="mailto:Libraries@haskell.org" target="_blank">Libraries@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a><br>
</blockquote></div>