GithubHelp home page GithubHelp logo

very large memory footprint? about fontkit HOT 9 CLOSED

foliojs avatar foliojs commented on May 28, 2024
very large memory footprint?

from fontkit.

Comments (9)

devongovett avatar devongovett commented on May 28, 2024

My guess is that it's brotli, which is the compression format used by WOFF2. It's an Emscripten compile, so there is probably a huge typed array in there...

from fontkit.

devongovett avatar devongovett commented on May 28, 2024

Not seeing that high memory usage either. Looks like about 28MB to me running your snippet unchanged, or 13MB with brotli disabled. How did you measure, what version of node are you running, what OS, etc?

from fontkit.

Pomax avatar Pomax commented on May 28, 2024

Windows 7, running node 0.12.7, measurement is based on windows's process monitor for the node.exe process

screenshot 50

from fontkit.

Pomax avatar Pomax commented on May 28, 2024

Memory analysis using node-inspector shows a massive amount of memory used by JSArrayBufferData objects (based on shallow, not even deep, memory footprint).

screenshot 51

There are only 10 of these objects that the inspector can see, with three rather huge ones. Looking at which contained functions these things have, it does look like they're all from the brotli library

from fontkit.

devongovett avatar devongovett commented on May 28, 2024

Can you comment out the require('brotli') call in node_modules/fontkit/src/WOFF2Font.js and try it?

from fontkit.

Pomax avatar Pomax commented on May 28, 2024

With brotli's requirement simply set to brotli = false; // require("brotli"); the memory footprint drops to a paltry 34MB, so it looks like brotli is doing really weird things on Windows...

from fontkit.

devongovett avatar devongovett commented on May 28, 2024

Grr. I wanted to do a real JS port rather than use an Emscripten compile anyway, because the Emscripten generated source is really huge, which sucks for browsers. Guess this is just another reason.

from fontkit.

Pomax avatar Pomax commented on May 28, 2024

how do you want to track? close this issue and open a new on on the brotli repo, or keep this one open as reminder?

from fontkit.

devongovett avatar devongovett commented on May 28, 2024

foliojs/brotli.js#3

from fontkit.

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.