-
-
Notifications
You must be signed in to change notification settings - Fork 698
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
Re-enumerating every time massively slows down Chai #127
Comments
Great detective work; this will be really helpful to straighten out. Your #128 is a good start. I wonder if we could re-compute and cache the list of property descriptors every time |
Ideally, we'd want all those properties created in the Unfortunately, I haven't found a way to give a function another prototype than |
We actually used to do that, and you can give a function another prototype with And yes, modifying the Function prototype is a no-go. |
Only IE10? I didn't want to mess with But… It doesn't seem justified to suffer this performance loss just for those engines that don't implement |
Is the hit really in the |
It's both, but
|
Sigh. OK. Well, that's probably the best approach. Although I'd need to think about it for a while to make sure it's not going to introduce suble cross-browser differences that cause someone to pull their hair out after hours of debugging. In the meantime, you might find our old |
I've now quickly moved |
$ git co master
Switched to branch 'master'
$ time node ../test.js
real 0m22.186s
user 0m22.111s
sys 0m0.218s
$ git co proto
Switched to branch 'proto'
$ time node ../test.js
real 0m1.232s
user 0m1.176s
sys 0m0.062s |
#131 has been merged |
In
addChainableMethod
, we find this code:However, this re-enumerating very negatively affects performance. Consider this simple script:
This takes 22.6s with the re-enumeration code, and 0.6s without. That's huge.
Can this code somehow be:
However, profiling suggests that
defineProperty
itself is also expensive.The text was updated successfully, but these errors were encountered: