Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
WIP: Custom Attribute and Preferring Attribute Names over Properties Spike #10229
Do not merge this PR.
This is a work in progress PR to investigate the outcome of aggressively removing entries in the attributes lists and moving over to preferring attribute names over properties. My goals are:
I'm probably missing a few more, but I thought it might be neat to track this progression on Github.
Performance improvements (still TBD)
There are two factors I see: startup time and attribute generation time.
This PR avoids enumerating over a big list of properties at startup, but that process is pretty fast. More time is actually spent enumerating over the event list in SimpleEventPlugin. I'm seeing DOM property injection take from 1.5 to 2 milliseconds. Cutting 2ms isn't huge, but I'll try to get some better numbers.
Build size differences
Even with manually listing out the properties that we need special behavior for, there's still some savings:
ReactDOM his -6% gzipped. Pretty healthy cut. The server build drops by 30% in size, which isn't all that grand but fun to say at least
Improvement to authoring
Migration path for libraries
An interesting side effect of this is you no longer get helpful errors about attributes being spelt wrong yeah? I've always quite enjoyed that react does that especially for weirdness like
@jquense WIP! I think it would be great to maintain a manifest of all HTML attributes that we require inside
I've also pushed a new update:
All in all, even if we manually specify all configuration options for every single attribute, the GZIP size ends up being rough the same (or a bit lower) than enumerating over individual lists.
Hmm. Server tests fail, I think, because we removed the event plugins from server rendering, so they don't know what attribute names are events. Now that there's no whitelist to stop
So this check is out of date:
@gaearon I think I'm getting those lovey warnings you just added. Would you consider this a separate bug? It looks like that condition is checking for no reason. I'll do some more digging and possibly file an issue
referenced this pull request
Aug 1, 2017
@gaearon I'm possibly wrong, sorry for the noise if so: