-
-
Notifications
You must be signed in to change notification settings - Fork 670
(New Feature) Add EventEmitter to AssemblyScript? #1782
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The event emitter pattern typically used around Node.js is a little odd, as it requires quite a bit of dynamicness that is neither type safe nor particularly efficient. I know that @jtenner thought about this quite a lot in context of the (now stale) node lib, and my impression from it was that we'll very likely need either some sort of compiler integration (even though I don't know how that would work yet) or we'll have to resort to a safer (and sadly Node.js-incompatible) pattern. |
@dcode, Okay! I believe I'll make it into a GitHub module so I can implement fs.createReadStream(file: string): ReadableStream in WAKE. :) |
Closing... |
@dcodeIO , As of dynamicness, It only handles strings at the moment, and for performance, it seems to be ~1.5-2x faster than js when operating <500k times> If it is over 500k - 1m ops, NodeJS is much faster.... Here's a benchmark I performed. EventEmitter Bench. AssemblyScript: v0.18.19 Bench #1 (1k ops)
Bench #2 (10k ops)
Bench #3 (100k ops)
Bench #4 (250k ops)
Bench #5 (500k ops)
|
Closing (inactive) |
Hello everyone,
I was wondering if AssemblyScript planned to support an EventEmitter. I believe it would be a good addition because we could add stream support on top of it. I already have a working example that seems to work seamlessly. Adding an EventEmitter would stray from the Standard Library, but I believe it would be worth it. 😉
Working Example
The text was updated successfully, but these errors were encountered: