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

perf: make events somewhat faster #610

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

dragoncoder047
Copy link
Contributor

Hopefully this should make the evnt system a little faster, the tag-based events in particular.

Previously tag-baed events fired on all objects, but just returned early if the object wasn't the right tag; now, using the onTag and onUntag events the handlers are dynamically added and removed when tags change, reducing the overhead on each handler.

The big 3 per-frame events (onUpdate, onfixedUpdate, and onDraw) and also now handled using inlined KEvents so that the routing overhead and extra function calls of looking up the named event handler in KEventHandler goes away.

Copy link

pkg-pr-new bot commented Feb 17, 2025

Open in Stackblitz

npm i https://pkg.pr.new/kaplayjs/kaplay@610

commit: f440463

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