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

Allow prototype enhancements. #7

Merged
merged 1 commit into from
Jan 21, 2016

Conversation

jamestalmage
Copy link
Contributor

AVA currently creates an enhanced assertion object each time. This is costly. This allows prototype enhancement by adding a bindReceiver option.

Setting bindReceiver to true (the default), assertion methods have their this value bound to the original assertion object.

Setting bindReceiver to false causes the this reference to captured at the actual time of invocation. This allows the enhancement of prototypes.

@twada - Hold off on merging until I confirm performance improvements.

Reference:
avajs/ava#460

AVA currently creates an enhanced assertion object each time. This is costly. This allows prototype enhancement by adding a `bindReceiver` option. `bindReceiver` defaults to `true`, meaning assertion methods have their `this` value bound to the original assertion. Setting `bindReceiver` to false causes the `this` reference to be passed through from the actual invocation.
@jamestalmage jamestalmage mentioned this pull request Jan 21, 2016
@twada
Copy link
Owner

twada commented Jan 21, 2016

@jamestalmage Thanks for the improvement

Hold off on merging until I confirm performance improvements.

Sure 👍

@jamestalmage
Copy link
Contributor Author

Confirmed.

See avajs/ava#461

It wasn't the biggest problem, but it did improve that benchmark suite from 5 seconds to 4 seconds.

Merge at will! 😄

Let me know when it's released so I can update that AVA PR.

@twada
Copy link
Owner

twada commented Jan 21, 2016

LGTM. Prototype enhancement is long-sought feature of empower!
I'll cut a new release ASAP.

twada added a commit that referenced this pull request Jan 21, 2016
@twada twada merged commit 83000ac into twada:master Jan 21, 2016
@jamestalmage jamestalmage deleted the enhance-prototypes branch January 21, 2016 06:54
@jamestalmage jamestalmage restored the enhance-prototypes branch January 21, 2016 06:54
@jamestalmage
Copy link
Contributor Author

@twada - one more potential enhancement coming

@twada
Copy link
Owner

twada commented Jan 21, 2016

@jamestalmage Oh wow

Please feel free to update this branch or making another one.

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