Giter Club home page Giter Club logo

Comments (8)

thekip avatar thekip commented on June 4, 2024 1

In your very first message you point into the right place in sourcecode which should be parallelized. Start from there.

from js-lingui.

semoal avatar semoal commented on June 4, 2024 1

I know that Vitest instead of using jest-worker is using Piscina https://www.npmjs.com/package/piscina which is more robust by far than jest-worker, probably could be a good addition here

from js-lingui.

thekip avatar thekip commented on June 4, 2024

i considered implementing a worker thread pool to do so. But for first iteration stopped as it is now. You probably a first user who really started experimenting with that and we started getting the feedback.

If you have capacity for implement worker threads i would happy to help. But for now i'm out of capacity to do so by my own.

from js-lingui.

thekip avatar thekip commented on June 4, 2024

BTW p-limit doesn't really help here because while extracting we invoking Babel on a bundles, which are single big file. Babel is very CPU bound and synchronous by nature. In all bounding code there also not much async operations, so you will not benefit of running them in one node process.

from js-lingui.

yunsii avatar yunsii commented on June 4, 2024

Thanks for you patient explanation. I'm not familier with worker threads, but very interesting of it. I'll study the theory first, glad to join the work if possible.

from js-lingui.

thekip avatar thekip commented on June 4, 2024

FYI https://www.npmjs.com/package/jest-worker

from js-lingui.

thekip avatar thekip commented on June 4, 2024

The caveat of working with workers - you don't have a shared memory between it. Treat them as few standalone nodejs programs ran by another one.

So if you want to expose something for all workers, you could not just store it in some global variable. Usually, passing data between main / child processes is done by serializing and storing in some place, and then reading and deserializing it on another side. So you could not pass from main process to child something non-serializable, say a function or class instance.

In lingui there might be few places where it's needed, and should be re-designed in a different way.

  • Passing a lingui config to child workers (config is not serializable to json, as it might have custom formatters / extractors as function). So you rather need to read config in each thread by it's own (this might bring a significant overhead!)
  • Passing a Catalog instance object, this should be just designed in diffrent way.

from js-lingui.

yunsii avatar yunsii commented on June 4, 2024

Got it, how about make each worker to extract each entry? It seems isolated.

from js-lingui.

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.