simulacra icon indicating copy to clipboard operation
simulacra copied to clipboard

JS Benchmark - Keyed Version

Open davidbwaters opened this issue 6 years ago • 1 comments

Hey. I noticed simulacra is listed as 'non-keyed' in the benchmarks test by JS Performance Benchmarks. They define the classification:

Keyed implementations create an association between the domain data and a dom element by assigning a ‘key’. If data changes the dom element with that key will be updated. This feature might be necessary when integrating with 3rd-party libraries, transitions or when the DOM keeps some state. Non-keyed implementations are free to reuse the existing dom nodes in whatever way they like and thus might be faster, but may cause issues if there’s a dependency on the particular dom nodes.

Here is an overview of the classification and potential problems.

This is out of my scope, but if I am understanding correctly from the readme section on safety-checks, simulacra is keyed by default. The benchmark includes a test that is supposed to check if a library is keyed or not, which I'm assuming classified simulacra as non-keyed.

If simulacra is keyed or can be configured to be, I'd like to see how performance is effected. It scores very high in the current test, as it stands.

Is simulacra keyed by their standards described above? If not, is there a reason why safety checks to prevent the potential problems tracking DOM nodes mentioned were not included or shouldn't be added? Thanks.

davidbwaters avatar Apr 15 '18 06:04 davidbwaters

Hi there, sorry for the late reply, I was on vacation.

I think I could implement a "keyed" version but I don't see the motivation. If you look at the difference between vanilla keyed vs non-keyed, non-keyed performs faster in certain operations like replacing rows, because it is allowed to make optimizations that aren't possible with keyed implementations.

gr0uch avatar Apr 21 '18 20:04 gr0uch