Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drastic file size increase #52

Open
stephanos opened this issue Oct 26, 2014 · 5 comments
Open

drastic file size increase #52

stephanos opened this issue Oct 26, 2014 · 5 comments

Comments

@stephanos
Copy link

I integrated om-tools into David Nolen's original TodoMVC application and noticed that the app's final JavaScript output (with advanced compilation) grows from 201 KB (48KB gzipped) to 262 KB (61KB gzipped). Note: That's with Om, secretary and sablono but without React.js.

That seems quite excessive for basically only replacing (reify ...) with defcomponent. Did you observe a similar result for your project? Is there anything I can do to mitigate the increase?

@kenrestivo
Copy link

It's pretty big. On a project I tried it on:
with om-tools: 532,318 bytes
without om-tools: 463,374 bytes

So, yeah, ~69Kb for not having to type om/IRenderState, and being able to write (om/div {:on-click ...}) instead of (om/div #js {:onClick ...}).

In a large project the readability might be worth the size/download-time cost though...

@GetContented
Copy link

It's actually not having to type ANY of the protocol definitions. Also, not having to put that nil argument in which litters every single call to a dom element helper. For complex UIs, this becomes a much more viable proposition for later reading (ie I don't have to "scan out the noise" as much as I read through the code... a principle which Rich Hickey seems to have applied very much to LISP when choosing the syntax of Clojure. Take let bindings in schemes or other lisps... they're so painful, the number of parens you have to use.)

Having said this, I had similar concerns about my not using Schema at all and also the amount of extra code being included and generated around my simple usage of om-tools.

It has been noted to me at that time that:
"Upcoming version of om-tools will even remove the small amount of code that goes unused (and removed by optimizer) this to be exactly what you're looking for."

omcljs/om#254

@stephanos
Copy link
Author

That's sounds great! Is there more you can say about the upcoming optimizations? Expected reduction? ETA?

PS: I use sablono which already eliminates all 'nil' arguments.

@GetContented
Copy link

@stephanos I'm not part of prismatic, or working on it. You'd have to ask the prismatic guys, in particular @loganlinn was the individual who replied to me.

@loganlinn
Copy link
Member

@stephanos I will look into removing any extra code generated from defcomponent when no schema features are utilized. Note that some size differences will still be expeceted per-component because a default IDisplayName is generated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants