Giter Club home page Giter Club logo

Comments (6)

jpweeks avatar jpweeks commented on May 18, 2024 2

Is it completely out of the question to use ES rather than commonJS modules?
Using something like https://github.com/rollup/rollup to compile the distributable module will save space as well as improve initialization performance. This is the route Three.js is going (mrdoob/three.js#9310).
cc @Rich-Harris

from regl.

mourner avatar mourner commented on May 18, 2024 2

I second the Rollup suggestion — it's wonderful.

from regl.

Rich-Harris avatar Rich-Harris commented on May 18, 2024 1

I put my money where my mouth is, if anyone on this thread is interested --> #364

from regl.

vorg avatar vorg commented on May 18, 2024

How does rollup would help here? regl doesn't have any 3rd party dependencies so is there anything that would be skipped during three shaking?

from regl.

Rich-Harris avatar Rich-Harris commented on May 18, 2024

As an enthusiastic regl user I'd be more than happy to help out with a conversion to ES modules.

@vorg Tree-shaking is an overstated benefit in many cases – the real benefits come from what has been termed 'scope hoisting'. With ES modules you don't need to wrap each module in a function and put it in a central cache; instead, everything lives in the same scope. You end up with a good deal less code (no per-bundle cost of including a require implementation, or per-module cost of function wrapper + require statements, etc) which is inherently more minifiable (because more things are variables rather than unmangleable properties of exports), and the real-world evidence is that parse time is considerably reduced by this approach.

You can get a feel for the sort of code Rollup generates here or using the interactive demo.

from regl.

mikolalysenko avatar mikolalysenko commented on May 18, 2024

I'm open to trying some stuff out. We've got benchmarks regarding size reductions so whatever works and makes it smaller I'm game for.

from regl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.