facebook/react — pull request #1508 by syranide (2014-05-10 11:03:50+00:00)
Title: JSX should use a "children" array instead of variable arguments

Intuitively it seems like this would be a performance win as we can bypass the run-time addition of `children` to `props` and also avoid an array allocation/population if there are multiple children.

Does it really matter in the end? I made a very crude test for the perf-suite, it `renderComponent` the same tree 100 times (exact tree below).

Due to GCing kicking in often it's hard to provide any conclusive results. But after running the tests on IE11/Chrome many times I think I'm (imagining) seeing a consistent perf improvement of a about ~1-3%. It seems like the graph is slightly less jaggy, but it could simply be a result of unrelated factors. So in large hierarchies with lots of redundant renders it could probably provide a measurable but very minor improvement, but by and large it's probably safe to say it does not have a measurable impact.

The downside to all of this is the produced code is not as neat and slightly bigger because of `children: []`, although the size should even out after GZ.

I'm probably :-1: on this myself but thought I'd post it FYI if you see it differently. Also, perhaps you still want my "addition" to `ReactDescriptor` that improves it to always check the validity of `props.children` (in `__DEV__`).

```
React.DOM.div({title: "abc", children: [
React.DOM.div({title: "abc", children: [
React.DOM.div({title: "abc", children: [
React.DOM.div({title: "abc", children: "a"}),
React.DOM.div({title: "abc", children: "b"}),
React.DOM.div({title: "abc", children: "c"})
]}),
React.DOM.div({title: "abc"}),
React.DOM.div({title: "abc"})
]}),
React.DOM.div({title: "abc"}),
React.DOM.div({title: "abc"})
]})
```