Skip to content
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

Further code size reduction #68

Closed
wants to merge 3 commits into from

Conversation

BribeFromTheHive
Copy link

No description provided.

This proposal introduces changes to the createNanoEvents function that focus on improving efficiency and decreasing code size, in line with the original author's intent. The main modifications include:

- Replacing the index-based for loop in the emit function with a more concise for...of loop. This change not only reduces the code size, but also enhances readability.

- Refactoring the `on` function to remove event listeners by using `splice` instead of `filter`. This change improves efficiency by avoiding unnecessary array creation, as well as reduces the overall code size.
@ai
Copy link
Owner

ai commented Jul 4, 2023

The test is broken and the benchmark is 2-5 times slower (before after).

I am closing this attempt. If you find a way to fix it, open a new PR.

@ai ai closed this Jul 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants