-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Optimize based on w3c/respec#453 #1156
Comments
The reason So basically 90% of the time (in that test), jsdom is walking the document |
I don't see any document-walking in https://github.com/tmpvar/jsdom/blob/54c2ed4cb7eaa3cdf9798b052ed79641f26f3e9d/lib/jsdom/named-properties-tracker.js#L66 ... |
Oh, it's in |
Oh btw, if anyone wants to generate a profile: https://gist.github.com/Joris-van-der-Wel/4705395c018f12053968 NamedPropertiesTracker could be improved by tracking all id's and name's in a map for the entire document.
|
A solution for both issues:
Step 1 is used in both compareDocumentPosition and NamedPropertyTracker. Step 2 and 3 only in NamedPropertyTracker. You can then implement
So instead of walking over a lot of nodes ( The NamedPropertyTracker's resolve function for window is then modified:
|
Wicked cool! |
@Joris-van-der-Wel mind running a profile again and finding what our biggest time-sinks are with the current release? 8 seconds is still nontrivial. Alternately if you don't think there's too much to be gained from this test case in particular, we can close this issue. |
The runtime has gone up a fair bit since the whatwg-url stuff (cc @Sebmaster). Here are some bottlenecks:
|
Damn, |
The base URL caching seems like lower-hanging fruit to be honest. |
whatwg-url is only used in |
It also handles all the other attributes URLUtils provides (i.e. hostname, port, etc.).
I don't think so, we should be able to provide this lazily, although I'm not sure if we want to put this into whatwg-url (I'd rather not), or wrap the accessors in jsdom. |
Right, the problem I think is that whatwg-url is implemented according to spec, which is not lazy. But, browsers implement this lazily (according to a recent comment on whatwg/url). I think it would be reasonable for whatwg-url to either be lazy by default or implement a lazy-mode (I'm thinking, mixinURLUtils takes a "getTheInput" callback?). It would not be observably different in any way you could expose from the outside interface. But, up to you @Sebmaster. |
See @Joris-van-der-Wel's comments in https://github.com/w3c/respec/issues/453#issuecomment-115999039. Ideas:
The text was updated successfully, but these errors were encountered: