cljs-dev

ClojureScript compiler & std lib dev, https://clojurescript.org/community/dev
2019-09-02T15:01:53.030Z

What is the reason sort is implemented as to-array -> garray/stableSort -> seq? Is it still faster than doing sorting in cljs?

favila 2019-09-02T18:35:01.030400Z

This is also what Clojure does

favila 2019-09-02T18:36:42.032900Z

Modern js guarantees stable sort now, so could use native array sort instead of stableSort now (saves extra allocation I think, I don’t remember the impl exactly)

favila 2019-09-02T18:37:33.033600Z

What are you thinking of that might be better?

thheller 2019-09-02T18:41:49.034800Z

how else would you sort? you always go to an array and sort that in a mutable way. even doing it with transients would probably be a lot slower

thheller 2019-09-02T18:44:17.035900Z

* Runtime: Same as <code>Array.prototype.sort</code>, plus an additional
 * O(n) overhead of copying the array twice.

thheller 2019-09-02T18:45:16.036200Z

would be interesting to see how much that overhead is in practice