b47b2932

By: Tom Sydney Kerckhove <syd@cs-syd.eu>

Compare declarations by Unique with a structural tie-break

Ord Declaration was a lexical comparison of the module and occurrence names,
which the profile showed to be a hot spot (every Set/Map Declaration operation
pays it). Compare by the occurrence name's FastString Unique (an Int, and what
its Eq already uses) first, falling back to the original structural comparison
only to break Unique ties -- keeping the instance consistent with the derived
Eq. (Comparing the *module* by Unique was tried and was slower: a Module's
Unique is not a cached field.)

Because Set Declaration is now ordered by run-dependent Uniques, break ties in
the output sort with the declaration's display name so the reported order stays
deterministic.

~15% less mutator time on a large real corpus, output unchanged.

Suite timing

Time to Start Worker time Duration Time to finish Idle
Config 4m22s 1s 1s 4m24s 4m22s
Eval 21m17s 21s - - 16m53s
Build - - - - -
Suite 4m22s 22s - - 21m16s

Timeline

0s21m20s21m30s