Live data from Hacker News

Greenlet – Move an async function into its own thread in the browser

github.com

1–10 of 46 posts

Re: Greenlet – Move an async function into its own thread in the browser

#3
Worth mentioning: workerize[0], which Jason released a couple weeks ago, allows you to move entire modules to a web worker.

greenlet is a bit like "workerize-lite" in the sense that it allows you to move individual functions to their own thread.

Also relevant: a discussion with Jason yesterday about when it's worth moving functions to a web worker: https://twitter.com/mxstbr/status/957312201987063808

https://github.com/developit/workerize

Re: Greenlet – Move an async function into its own thread in the browser

#4
post #3

Worth mentioning: workerize[0], which Jason released a couple weeks ago, allows you to move entire modules to a web worker. greenlet is a bit like "workerize-lite" in the sense that it allows you to move individual functions to their own thread. Also relevant: a discussion with Jason yesterday about when it's worth moving functions to a web worker: https://twitter.com/mxstbr/status/957312201987063808 https://github.c…

workerize looks very nice. I've used https://github.com/borisirota/webworkify-webpack in the past but wasn't 100% satisfied.

Does anyone know of write-ups documenting performance of the various methods of pushing data to and from WW across different browsers?

Re: Greenlet – Move an async function into its own thread in the browser

#5
This is off-topic, but at the top of the readme is this:

> The name is somewhat of a poor choice, but it was available on npm.

npm has supported scoped packages [0] for years now, and it's a fantastic solution to this problem, as well as solving many others (like typosquatting in many cases).

I know this package is already named, but I really urge people to use scoped packages more.

[0] https://docs.npmjs.com/misc/scope

Re: Greenlet – Move an async function into its own thread in the browser

#7

The code could use some work. I have no idea what's going on L18. https://github.com/developit/greenlet/blob/master/greenlet.j...

It's not just line 18, I barely have any idea what any lines are doing. Single letter variable names are almost always a bad idea except in one case, using `i` as an index, and even then I don't do that any more because `index` is more obvious.
Post reply on HN