jsdom / cssstyle

A Node.js implementation of the CSS Object Model CSSStyleDeclaration interface
MIT License
109 stars 70 forks source link

Performance #33

Closed marcelklehr closed 9 years ago

marcelklehr commented 9 years ago

I believe this module is responsible for a huge performance break in my current jsdom-based project. Specifically this line https://github.com/chad3814/CSSStyleDeclaration/blob/master/scripts/generate_properties.js#L22

I am not qualified to say how to solve this, but it seems that dynamically loading a node module with readFileSync is not a good idea.

I'd love to hear your throughts.

chad3814 commented 9 years ago

Well, generate_properties.js just runs once before the npm module is published (see https://github.com/chad3814/CSSStyleDeclaration/blob/master/package.json#L37). It does that, in fact, to speed things up.

If you have some code you believe to be slow, I can try to look into it.

marcelklehr commented 9 years ago

I have a test case that uses vdom-virtualize to serialize a 20x10 table. With the current code it takes 14s, with my proposed changes in #34 it takes 475ms.