Conversation
1ef7e5c to
98d72dd
Compare
There was a problem hiding this comment.
It seems like this approach involves, at runtime, looking up whether the property is case sensitive. This requires loading a lot of data into the distributed package and into memory, a caching layer to speed it up, a large package bundle size, etc.
But that information is available at npm run prepare time instead.
Could we instead split createGenericPropertyDescriptor() into two functions, createGenericCaseSensitivePropertyDescriptor() and createGenericCaseInsensitivePropertyDescriptor(), and inside generatePropertyDescriptors.mjs pick the correct one?
Edit: actually, it could still be one function createGenericPropertyDescriptor(property, { caseSensitive }).
|
If we want to process it at prepare time, it would be better to add caseSensitive key and value to the properties in propertyDefinitions Map? |
|
I'm not sure which is best and OK to leave the choice to you. My understanding is that current architecture is split into two steps:
We could extend this to add a bit more information in step 1 to I guess the most efficient architecture would be something like:
Then we could run 1) and 2) in parallel at prepare-time, and the package size + runtime memory overhead would be minimal. But I do not fully understand which fields ( (There is also compromise architecture, which could start with current architecture but then have a step 3 which deletes fields from |
|
Submitted another PR. |
Fixes #303
generatePropertyDefinitions.mjstogenerateDefinitions.mjs.lib/generated/syntaxDefinitions.js.lib/parsers.jsthat checks whether syntax is case-sensitive.lib/parsers.jsto integrate cache checking and setting.lib/utils/propertyDescriptors.js.Regression test
jsdom/jsdom#4032
Benchmark results
jsdom/jsdom#4031
jsdom main + cssstyle@5.3.7:
jsdom main + linked cssstyle patch without cache:
jsdom main + linked cssstyle patch with cache: