
9 Oct
2011
9 Oct
'11
1:05 p.m.
Excerpts from Greg Weber's message of Sun Oct 09 12:39:03 -0400 2011:
So first of all I am wondering if a sum type comparison does in fact scale linearly or if there are optimizations in place to make the lookup constant or logarithmic. Second, I as wondering (for the routing case) if Haskell can make a string case comparison logarithmic so that users can use case comparisons instead of maps for string collections that are known at compile time and won't change.
GHC will compile case-matches over large sum types into jump tables, so the lookup becomes constant. I don't think we have any cleverness for strings. Edward