-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Incremental builds #317
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
Comments
Wouldn't this break |
Thanks for opening this. I agree we want to eventually get here. Some subtasks:
|
@pluma it won't break it no. But of course, if you require |
π here. I love this library but 56kb is a tough pill to swallow. |
It's only 15kb if you serve the min file and your host uses gzip (they all do) |
I'll note that's 1/10th the size of most JPEGs on your site |
Oh I certainly didn't mean it as a petty attack, I apologize if I came across that way. In the grand scheme of things, 15kb is nothing compared to the value you get out of this library. But I did to express my interest in exploring ways to reduce this weight. It just feels like there's an easy win here. |
No worries, no harm. I just want to make sure the number is clear, and it's in perspective. I just also want to caution looking at this task as a source a big win. In it's current form, this isn't going to do much for you, but what this task does do is allow for the library to expand and include new data structures without impacting byte size. That's going to be important as I plan to add SortedSet/Map and more useful structures in the future. Currently the bulk of the library is distributed across three files: Iterable, Map, and List. List and Map both extend from Iterable, so at the very most you could drop from 15kb to 10-12kb if your application uses only Maps or only Lists. I also haven't evaluated how much weight using Webpack or Browserify would add to the size for partial builds vs the ultra-thin Esperanto packager currently used for full builds, my hypothesis is somewhere around 0.5-1kb, but this is something I'll investigate. |
+1 |
+1! |
I would love a modular approach as well, now that Or maybe a Still, many thx to your hard work. |
Thank you for reporting this issue and appreciate your patience. We've notified the core team for an update on this issue. We're looking for a response within the next 30 days or the issue may be closed. |
I would just like to point out some issues around getting rid of toMap(). Take a look at #600 and #697. Ideally, this sort of behavior would fit better under the map() function, but you cannot specify keys via map() currently. |
RxJS has great structure that allows to add operators and typings to prototype at runtime (e.g. add/map and map). But as @leebyron said in #1044 (comment)
It would be overkill for current implementation. To make profit from it - we totally should add another dozen of methods to operate on collections Also from #1044 (comment)
This can be solved with |
I know my team uses just fromJS, merge, mergeIn, set, get, setIn, getIn. That's basically it. Perhaps groups of prototype methods could be added on demand. So I'm going from the naming in the docs here, these groups could be optionally loaded:
The other method groups would probably not be optional, but don't seem necessary for a "lite" version of immutablejs. Also curious you say it's just Map and List, but there is also OrderedMap, Set, OrderedSet, Stack, Range, Repeat, Record, Seq. Those data types should also be optional. |
Yeah we also use basically fromJS, merge, mergeIn, set, get, setIn, getIn. Looking forward to this. I will note the main issue is not with the actually size of immutable, its just when you add all the other deps in a normal project they really add up. 20-30% off each library adds up to allot |
π |
I'm going to close this issue since we now export an ES module as well, which tools like webpack and rollup will use when bundling to achieve tree shaking. We should still attempt to deprecate methods like |
Without going off the deep-end with modularity, it might be nice to have a way of incrementally building the library. For instance to specify which types are included when building in the grunt cli.
Not sure how this would look, or whether including a separately built directory for grabbing absolute
require
paths might be preferable, e.g..You'd lose out a bit on the bytes shaved by compiling the library as a single file, but I'd imagine omitting entire types would make up for it depending on the case.
The text was updated successfully, but these errors were encountered: