Big slow down compared to ocamlspot for 3.12.x

Issue #10 resolved
Jun Furuse
repo owner created an issue

Sometimes ocamlspot runs x10 slower compared to its older version for OCaml 3.12.x. Profiling indicates it performs too much comparison for set operation.

Found the cause. OCaml's Set.filter's behaviour was changed by rev 12510:

Revision 12510 - (view) (annotate) - [select for diffs] Modified Wed May 30 11:28:51 2012 UTC (2 months, 3 weeks ago) by scherer Original Path: ocaml/version/4.00/stdlib/ File length: 11418 byte(s) Diff to previous 12217 Ensure that {Set,Map}.{filter,partition} call their functional argument in the user-expected left-to-right evaluation order.

This is a cosmetics change but users usually expect the mapping/filtering functions to be called in increasing key order. As the order for filter and partition changed recently anyway (commit r12026), it makes sense to "fix" it now.

I used Set.filter to obtain the "middle" element from the set for bin-search algorithm, but now it gives always the min elt. That's why the program slowed down a lot. Of course the use of filter to get the middle element was a dirty but handy workaround. I must reimplement Set.

Comments (4)

  1. Log in to comment