Re: [w3c/webcomponents] [idea] Make use of `observedAttributes` optional (#565)

As a web developer, @WebReflection's idea seems like a pretty neat and useful way to split the difference between performance and flexibility here.

I definitely appreciate that using an expression of some sort (whether a regex or something else) certainly has a little overhead, but am curious as to whether the memory cost of caching the results is really that high—since the list is specific to the custom element *type*, not the instance, it doesn’t *seem* like that’d be a really huge cost. And wouldn’t the cache effectively be the same as just prepending a matched attribute name to the list anyway? Would it be any more expensive (memory-wise) than an author providing a list of 10 strings rather than a list of two expressions? (I *do* get than this means using mutable, non-fixed length structures, but I have to imagine there are lots of opportunities for smart optimizations, too.)

And if we can expect people to use a similar set of attributes on most instances of an element (again, this *seems* like a reasonable assumption to me), wouldn’t we be likely to arrive at a relatively fixed list of strings that pretty much always matches before falling back to one of the provided expressions pretty quickly?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/webcomponents/issues/565#issuecomment-248361627

Received on Tuesday, 20 September 2016 16:51:59 UTC