binaryage / cljs-oops

ClojureScript macros for convenient native Javascript object access.
Other
351 stars 13 forks source link

under advanced mode, goog-based implementation has better DCE #1

Closed darwin closed 8 years ago

darwin commented 8 years ago

Currently oops can generate key get/set code either via aget/aset or goog.object/get/goog.object/set [1].

My compilation output tests under advanced mode showed that DCE is more aggressive with goog.object implementation. Compare [2] and [3].

And I don't understand why. Any insights?

[1] https://github.com/binaryage/cljs-oops/blob/61416373ff8415410c52de1603df76375c848299/src/lib/oops/core.clj#L69-L77 [2] https://github.com/binaryage/cljs-oops/blob/master/test/transcripts/expected/basic_oget_core.js [3] https://github.com/binaryage/cljs-oops/blob/master/test/transcripts/expected/basic_oget_goog.js