HeapsIO / domkit

CSS Components based strictly typed UI framework for Haxe
MIT License
84 stars 20 forks source link

Speed up rule selection #15

Closed ncannasse closed 2 years ago

ncannasse commented 4 years ago

Currently we check all CSS rules for each object. It's very fast but it doesn't scale with huge CSS files.

I tried implementing the following approach : filter top rules by (component+id) but it didn't work out very well. Reduces checks by only about 30%, because

I guess we might need a more top-down approach were we reconstruct the Rule tree then filter based on parent-contextual rules.

ncannasse commented 4 years ago

rules_optimize branch is a bit better than first attempt. Reduces matches by 2-10 with not much book-keeping. But not enough to merge for now. Would require some generalization by taking parent RuleGroup into account to further reduce the number of rules.

ncannasse commented 2 years ago

There's a rule caching mechanism that was introduced in 366bd6760d786b764f72222ac5f0df07560c7971