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

Adding caching for this._isFulfilled(). On an app I tested it in, the av... #505

Closed
wants to merge 4 commits into from

Conversation

marchant
Copy link
Contributor

...erage time for Promise._settlePromiseAt() was 12ms, with that change, going down to 7ms, and total, going down from 900ms to 760ms, so about 18% performance increase

… average time for Promise._settlePromiseAt() was 12ms, with that change, going down to 7ms, and total, going down from 900ms to 760ms, so about 18% performance increase
…s significantly faster than the current observe being used as well as faster than timeout. It’s also a whole lot more backward compatible then MutationObserver. I would suggest to remove the observe based schedule entirely, but left it there for you to review. On my Macbook Pro, Chrome 40, on https://github.com/montagejs/popcorn load, Async.drainQueues goes from 1.7ms self (~1158.3 ms total) to 0.3 ms self (~547.1 ms total). Promise._settlePromiseAt  goes from 12.9 ms self (~1147.1 ms total) to 7.8 ms self (~ 762.1 ms total)
@marchant
Copy link
Contributor Author

All test passed with node tools/test

@petkaantonov
Copy link
Owner

First about the scheduler, MessageChannel is unacceptable because it is bugged in some browsers. If this is ok for your application then you can use Promise.setScheduler but it cannot be used in the general case.

I cannot see any difference from the isFulfilled caching alone, testing in node 0.12

@marchant
Copy link
Contributor Author

Promise.setScheduler, excellent, works like a charm, well done. I’m focusing tests on client, and especially mobile, it matters there. If there’s no difference on node than sounds like a win to me.

On Feb 20, 2015, at 12:01 AM, Petka Antonov notifications@github.com wrote:

First about the scheduler, MessageChannel is unacceptable because it is bugged in some browsers. If this is ok for your application then you can use Promise.setScheduler but it cannot be used in the general case.

I cannot see any difference from the isFulfilled caching alone, testing in node 0.12


Reply to this email directly or view it on GitHub #505 (comment).

@petkaantonov
Copy link
Owner

I don't have a mobile to test but if we are gonna do this we can do much better. We can load the bitfield once and use a macros like IS_FULFILLED(bitField) which compiles to e.g. ((bitField & 21319204) !== 0) so that testing all flags is fast and don't require a method call and a memory load.

@marchant
Copy link
Contributor Author

That sounds great!

On Feb 20, 2015, at 12:13 AM, Petka Antonov notifications@github.com wrote:

I don't have a mobile to test but if we are gonna do this we can do much better. We can load the bitfield once and use a macros like IS_FULFILLED(bitField) which compiles to e.g. `((bitField & 21319204) !== 0) so that testing all flags is fast and don't require a method call and a memory load.


Reply to this email directly or view it on GitHub #505 (comment).

@benjamingr
Copy link
Collaborator

@marchant you should develop against 3.0 (the coming release) and not against master fwiw.

@marchant
Copy link
Contributor Author

Ok, thanks, I'll have to figure out how to do the browser build then!

On Feb 23, 2015, at 10:43, Benjamin Gruenbaum notifications@github.com wrote:

@marchant you should develop against 3.0 (the coming release) and not against master fwiw.


Reply to this email directly or view it on GitHub.

@petkaantonov
Copy link
Owner

node tools/build --browser

@marchant
Copy link
Contributor Author

Thanks, appreciated!

On Feb 23, 2015, at 11:48, Petka Antonov notifications@github.com wrote:

node tools/build --browser


Reply to this email directly or view it on GitHub.

@marchant
Copy link
Contributor Author

What is 3.0 bringing?

On Feb 23, 2015, at 10:43, Benjamin Gruenbaum notifications@github.com wrote:

@marchant you should develop against 3.0 (the coming release) and not against master fwiw.


Reply to this email directly or view it on GitHub.

@petkaantonov
Copy link
Owner

@marchant

  • Website with better documentation, guides, tutorials, how-tos etc..
  • New cancellation and all the issues which are labeled 3.0 in github
  • A minor backward incompatible with Promise.delay, which puts the optional value argument as last instead of first
  • Fair perf increase, especially for the parallel benchmark which now in 3.0 actually performs faster than the sequential one!

@benjamingr
Copy link
Collaborator

@marchant also:

  • Better debugging experience with warnings that let you know about many common pitfalls (like a lint)
  • Cleaning the API.
  • Promises got a lot lighter (allocating them now is dirty cheap, cheaper than allocating an empty array)

@petkaantonov
Copy link
Owner

Outdated example of warnings: http://imgur.com/a/t3xng (constructor return is removed now and several new ones are added that are not in the album)

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.

3 participants