Giter Club home page Giter Club logo

Comments (3)

vanruesc avatar vanruesc commented on June 8, 2024

Hi ahmadsholehin,

I've moved the math code from three into math-ds to reduce the bundle size for projects that don't use three.

The real problem lies with the tree-shaking implementation of popular bundlers. Unfortunately, all of them are rather conservative in that aspect and don't actually remove a lot of unused code. If tree-shaking worked flawlessly, depending on three would be an option. But even then, the math code from three should reside in a separate module to speed up the bundling process. Code analysis takes a while and three is big.

The sparse-octree library only uses Box3, Ray and Vector3 from math-ds and yet all the other unrelated classes get included in the final bundle for no reason. That's still much less unused code compared to using three as a dependency in projects that don't use three. When I created sparse-octree for one of my projects, it did rely on the math classes from three. But then my bundles all included a stupid amount of unused classes from three. The compromise was to use a dedicated math module.

I'm keeping an eye on the bundling output, but nothing has changed in the past years.

from sparse-octree.

vanruesc avatar vanruesc commented on June 8, 2024

I'm keeping an eye on the bundling output, but nothing has changed in the past years.

After looking into the build setup again, I found out that rollup-plugin-babel is breaking the tree-shaking. I've changed the setup in 9f1d286 and now the unrelated classes are gone from the final bundle.

So if your build setup is configured correcty, the actual footprint of the math-ds dependency will be very small.

from sparse-octree.

vanruesc avatar vanruesc commented on June 8, 2024

Closing due to inactivity.

from sparse-octree.

Related Issues (17)

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.