Updated patch attached:
1) Removes #if 0 optimizations
2) Changes #if 0 to #if NOT_USED for code that's there for completeness and to
keep the code self-documenting purposes rather but isn't needed by anything
currently
3) Fixed cost model to represent bounded sorts