react icon indicating copy to clipboard operation
react copied to clipboard

There is a math error in documentation ref-08-reconciliation

Open yajiex opened this issue 10 years ago • 3 comments

Do you want to request a feature or report a bug?

bug

What is the current behavior?

See react/docs/docs/ref-08-reconciliation.md, there is a line,

This means that displaying 1000 nodes would require in the order of one billion comparisons. This is far too expensive for our use case. To put this number in perspective, CPUs nowadays execute roughly 3 billion instructions per second. So even with the most performant implementation, we wouldn't be able to compute that diff in less than a second.

Considering it mentions that CPUs execute 3 billion per second while we require 1 billion comparisons, why it come to a conclusion that we wouldn't be able to compute the task in less than a second?

What is the expected behavior?

I guess the expected behavior would be either provide the correct CPUs time or update the conclusion.

Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?

It's a documentation bug.

yajiex avatar Jun 08 '16 09:06 yajiex

One comparison is probably more than one instruction executed on the CPU though.. My guess is they take this into consideration when stating that a CPU capable of executing 3 billion instructions per second won't be able to perform one billion comparisons in the same timeframe.

EDIT: reference

GGAlanSmithee avatar Jun 08 '16 10:06 GGAlanSmithee

Yeah I don't really see the problem, it could certainly be refined but it's not wrong. One comparison does not translate to one CPU instruction, not even close. IMHO, you could drop the entire point about the CPU, 1000 becoming 1 billion comparisons is enough to convey the severity.

syranide avatar Jun 08 '16 13:06 syranide

Yeah, I think this is fine. There is nothing factually incorrect here. Since it's fine as-is, I'm going to close out the issue.

If you can propose an alternate wording that people like better, we can update the docs. Feel free to discuss at discuss.reactjs.org or continue the discussion on this thread.

jimfb avatar Jun 08 '16 20:06 jimfb