You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, because of the way the writer is set up, Google Closure will not DCE any CLJS core data structures that are otherwise unused by the developer.
Though, transit-js already support dynamically looking up an alias on the object itself. Thus by adding the alias to the prototype of the types, it'd enable proper DCE on lesser used types.
And removing the entries from the map in transito.core/writer, we enable DCE without losing any functionality.
This also works fine with GCC's advanced minification.
Edit: Should probably not reuse the types since user's may provide customs handler for types in which case the alias could fail. We could introduce some simple dummy deftypes that can for sure handle the conversion and alias it to those instead.
So:
(deftypeGenericListHandler [])
(deftypeGenericSetHandler [])
(goog.object/set (.-prototype PersistentQueueSeq) "transitTag" GenericListHandler)
(goog.object/set (.-prototype PersistentQueue) "transitTag" GenericListHandler)
(goog.object/set (.-prototype PersistentTreeSet) "transitTag" GenericSetHandler)
;; Then in the writer:
(merge
{GenericListHandler list-handler
GenericSetHandler set-handler
.....})
The text was updated successfully, but these errors were encountered:
Currently, because of the way the writer is set up, Google Closure will not DCE any CLJS core data structures that are otherwise unused by the developer.
Though,
transit-js
already support dynamically looking up an alias on the object itself. Thus by adding the alias to the prototype of the types, it'd enable proper DCE on lesser used types.So by using, for instance:
And removing the entries from the map in
transito.core/writer
, we enable DCE without losing any functionality.This also works fine with GCC's advanced minification.
Edit: Should probably not reuse the types since user's may provide customs handler for types in which case the alias could fail. We could introduce some simple dummy
deftypes
that can for sure handle the conversion and alias it to those instead.So:
The text was updated successfully, but these errors were encountered: