Ho visto questo commento in contenitori/dati/Set/Base.hsL'ordine dei costruttori/casi/guardie/if-then-else è importante per le prestazioni?
-- [Note: Order of constructors]
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- The order of constructors of Set matters when considering performance.
-- Currently in GHC 7.0, when type has 2 constructors, a forward conditional
-- jump is made when successfully matching second constructor. Successful match
-- of first constructor results in the forward jump not taken.
-- On GHC 7.0, reordering constructors from Tip | Bin to Bin | Tip
-- improves the benchmark by up to 10% on x86.
Dove altro si fa ordine hanno piccoli impatti misurabili sulle prestazioni? In particolare, mi chiedo delle dichiarazioni del caso con molte opzioni.
fyi, ghc 7.0 è stato rilasciato 4 anni fa, quindi le cose potrebbero essere cambiate da allora – ErikR
@ user5402, sì, ma non hanno. Questo particolare bit di codice non è stato toccato molto nella storia recente, non credo. – dfeuer