Repository navigation
implement node:events in javascript - #2604
Merged
Merged
Conversation
node:events in javscriptnode:events in javascript
paperclover
force-pushed
the
dave/events
branch
from
April 11, 2023 00:48
ca21a34 to
a7183d1
Compare
This comment was marked as resolved.
This comment was marked as resolved.
paperclover
force-pushed
the
dave/events
branch
from
April 13, 2023 18:48
1cbded4 to
e0ef5d7
Compare
node:events in javascriptnode:events in javascript + improve node createHash performance
1 of 3 tasks
paperclover
force-pushed
the
dave/events
branch
from
April 14, 2023 05:38
8027663 to
8e6a890
Compare
node:events in javascript + improve node createHash performancenode:events in javascript
paperclover
force-pushed
the
dave/events
branch
from
April 15, 2023 21:16
256c2c4 to
346c2c3
Compare
Contributor
|
✅ #fe3260916318ebe8a9840666f3955bb23fc29162 |
This was referenced Apr 17, 2023
paperclover
force-pushed
the
dave/events
branch
from
April 17, 2023 22:51
f3ae819 to
914bfa4
Compare
paperclover
marked this pull request as ready for review
April 17, 2023 22:57
Contributor
Author
|
3 opened issues for less important but missing features. passing all tests for everything else though |
Collaborator
|
looks like there are unintentional changes to submodules can you reset those? |
Collaborator
There was a problem hiding this comment.
We can make Array and Object come from primordials here
Suggested change
| var { isPromise } = import.meta.primordials; | |
| var { isPromise, Array, Object } = import.meta.primordials; |
paperclover
force-pushed
the
dave/events
branch
from
April 18, 2023 21:21
3602f16 to
2f6113e
Compare
Jarred-Sumner
added a commit
that referenced
this pull request
Apr 21, 2023
This reverts commit 96a2ed1.
paperclover
added a commit
that referenced
this pull request
Apr 24, 2023
This reverts commit a4d0a19.
paperclover
added a commit
that referenced
this pull request
May 17, 2023
This reverts commit a4d0a19.
paperclover
added a commit
that referenced
this pull request
May 23, 2023
This reverts commit a4d0a19.
paperclover
added a commit
that referenced
this pull request
May 30, 2023
This reverts commit a4d0a19.
paperclover
added a commit
that referenced
this pull request
Jun 1, 2023
This reverts commit a4d0a19.
paperclover
added a commit
that referenced
this pull request
Jun 1, 2023
This reverts commit a4d0a19.
Jarred-Sumner
pushed a commit
that referenced
this pull request
Jun 1, 2023
…2913) * Revert "Revert "use a lazyily initialized stream for `node:crypto` `createHash` (#2652)"" This reverts commit 613bb48. * Revert "Revert "implement `node:events` in javascript (#2604)"" This reverts commit a4d0a19. * oops * fix entrypoints stuff * fix hash copy * use native events for node streams and crypto * requested changes * oops * make discord.js work * fix webkit hash * headers tojson
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently,
node:eventsis implemented in C++, which may sound fast but ends up being much slower than a pure JS implementation as the rapid hopping between native code and JS with listener callbacks is a lot of overhead. This PR is not only porting the node.jseventsinto JS as closely as possible, but also trying to get it as fast as possible.Currently node.js own events implementation beats us, but we've gone from being 4x slower to something more like 2x.
Still debating which implementation details are best, such as
ObjectvsMap: they lead to different gains in different testsAlso, setting real-world benchmarks that tests actual usage instead of than a single ".emit()". Microbenchmarks are handy but we need to consider the bigger picture.
required todo:
events.exports.jsaddListenerandemitEventEmitter#once(implemented but check if can be made faster)EventEmitter#removeListener(reimplement)EventEmitter#prependListenerEventEmitter#listenerCountEventEmitter#typesEventEmitter.once(async iterator)EventEmitter.setMaxListenersEventEmitter.getEventListenersthings might not do in this PR
EventEmitter.on(async iterator)EventEmitterAsyncResourceFixes #2190