avoids jQuery's event system when binding on observes which fixes #280 #517

Merged
merged 1 commit into from Oct 28, 2013

Conversation

Projects
None yet
2 participants
@justinbmeyer
Contributor

justinbmeyer commented Oct 28, 2013

This avoids jQuery's slowish event system for observes. It also adds can.listenTo and can.stopListening which work similar to backbone's methods of the same name.

justinbmeyer added a commit that referenced this pull request Oct 28, 2013

Merge pull request #517 from bitovi/fast-jquery-events
avoids jQuery's event system when binding on observes which fixes #280

@justinbmeyer justinbmeyer merged commit f3c8c29 into master Oct 28, 2013

1 check passed

default The Travis CI build passed
Details
@imjoshdean

This comment has been minimized.

Show comment
Hide comment
@imjoshdean

imjoshdean Oct 28, 2013

Contributor

I'd love to have another one of your 15-30 minute lunch sessions where you explain the performance gains we get from this.

Contributor

imjoshdean commented Oct 28, 2013

I'd love to have another one of your 15-30 minute lunch sessions where you explain the performance gains we get from this.

@justinbmeyer

This comment has been minimized.

Show comment
Hide comment
@justinbmeyer

justinbmeyer Oct 28, 2013

Contributor

A session isn't likely necessary for this one.

jQuery does a lot of special things when registering an event listener: https://github.com/bitovi/canjs/blob/master/lib/jquery.1.9.1.js#L2721

For example, it handles special events, event delegation, namespaces, events on HTMLElements.

Our addEvent does far less:

https://github.com/bitovi/canjs/blob/master/util/event.js#L8

It basically pushes the handler on an array.

There's a LOT of event binding going on when you render 200 items in TodoMVC. It was the dominate part of the runtime. We replaced the observable event binding with something MUCH faster.

Contributor

justinbmeyer commented Oct 28, 2013

A session isn't likely necessary for this one.

jQuery does a lot of special things when registering an event listener: https://github.com/bitovi/canjs/blob/master/lib/jquery.1.9.1.js#L2721

For example, it handles special events, event delegation, namespaces, events on HTMLElements.

Our addEvent does far less:

https://github.com/bitovi/canjs/blob/master/util/event.js#L8

It basically pushes the handler on an array.

There's a LOT of event binding going on when you render 200 items in TodoMVC. It was the dominate part of the runtime. We replaced the observable event binding with something MUCH faster.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment