Comments (8)
I plan on supporting worker_threads
here soon.
from make-synchronous.
@mmkal This executes in a subprocess which has some benefits:
- Complete isolation.
- Cannot hang the process (worker threads can potentially hang the main process).
- Separate memory limit, so you could execute something that takes a lot of memory.
Yes, it's slower to launch a subprocess, but that only matters if you use it for short-running tasks. For long-running intensive tasks, the difference is neglible.
from make-synchronous.
Yeah, I've been thinking about moving to worker_threads
(and removing the current child process implementation). When I initially made this package, I was not aware that it could be done with worker_threads
too.
from make-synchronous.
Can I recommend user's to use synckit
instead in the README?
from make-synchronous.
It's about 300x slower.
Your benchmark is flawed. You should run a heavy operation in the worker to actually test it, not just a lightweight task. Also, the task you are running in the worker (fs.promises.readFile
) is already run in a background thread by Node.js.
from make-synchronous.
I plan on supporting
worker_threads
here soon.
That's great, I would follow your changes then.
from make-synchronous.
@sindresorhus I came here wondering what the advantages are of this over synckit. synckit seems well thought, fairly feature-rich out and widely used - do you think it's worth maintaining this rival at this point? Is there something missing from synckit that make-synchronous does better, or will do better?
This is a genuine question - it's often hard to tell what the tradeoffs of various libraries are, and maintainers tend to know best.
from make-synchronous.
Yes, it's slower to launch a subprocess, but that only matters if you use it for short-running tasks. For long-running intensive tasks, the difference is neglible.
Or if your task needs to be run many times, there will be huge difference too.
from make-synchronous.
Related Issues (8)
- Example doesn't work HOT 1
- Why not sleep-synchronously until the async call is done? HOT 2
- Passing parameter to first async call produces "No debugger available, can not send 'variables'" HOT 2
- Can't execute mariadb function wrapper HOT 2
- Accept `string` as function HOT 2
- node version HOT 2
- [feat] CJS HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from make-synchronous.