WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED WONTFIX
Bug 176586
Speedometer 2.0: Use keyed algorithm to render lists for Inferno suite
https://bugs.webkit.org/show_bug.cgi?id=176586
Summary
Speedometer 2.0: Use keyed algorithm to render lists for Inferno suite
Shiyu Zhang
Reported
2017-09-08 00:54:21 PDT
Created
attachment 320247
[details]
Use keyed algorithm for inferno Inferno has two ways of rendering lists: Keyed algorithm and Non keyed algorithm. Choosing which one to use is up to the developer. The guide from
https://infernojs.org/docs/guides/benefits/list-rendering
recommends that keyed algorithm can be used to minimize the number of patch operations. This performs better when changes between lists are minimal, just like the use case of Speedometer's todo-list. I applied the patch and rebuild the inferno suite to use keyed algorithm, 4x performance improvement for inferno suite was observed. I find that keys are already used for React framework. Shall we use the keys for inferno suite too?
Attachments
Use keyed algorithm for inferno
(797 bytes, patch)
2017-09-08 00:54 PDT
,
Shiyu Zhang
no flags
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Ryosuke Niwa
Comment 1
2017-09-10 16:28:54 PDT
I guess the big question is whether most apps written using Inferno end up using the keyd algorithm, and if there is a significant number of web apps written using non-keyd algorithm. If the non-keyed algorithm is a lot slower, then it's of our interest to test that case even if the majority of Inferno apps did indeed used keyed algorithm because the one of many goals of Speedometer is measure things that are currently slow in the browser.
Ryosuke Niwa
Comment 2
2017-09-10 16:31:36 PDT
In general, though, making test cases in Speedometer run faster is not a great thing to do. The whole point of this benchmark is to capture things that are slow, and encourage browser vendors to make things go fast. If we just tested the highly optimized code, then we're doing disservice to the Web developer community in that we'd be creating a subset of Web facing features that are so slow that nobody can use it. That would ultimately hurt the Web platform by making it harder to use "correctly", and increasing the amount of knowledge needed to write responsive apps on the Web.
Addy Osmani
Comment 3
2017-09-10 18:18:06 PDT
I wanted to echo Ryosuke's comment about the importance of Speedometer reflecting not what is necessarily best practice, but what is practically used by developers in real-world apps. It's likely that if the majority of React developers use a keyed algorithm to render lists that Inferno developers are probably doing something similar but it would be good to verify this as much as we can. I've reached out to Dominic Gannaway of Inferno for his take on this. We may also be able to validate this a little using HTTP Archive.
Shiyu Zhang
Comment 4
2017-09-12 03:26:28 PDT
I agree that Speedometer should be a workload to measure the real-world performance. I am also curious about whether the majority of Inferno developers would choose keyed algorithm for rendering lists like React developers do. Looking forward to hearing more feedback.
Addy Osmani
Comment 5
2017-09-27 14:48:14 PDT
Coming back to this after consulting with the Inferno author. His take was that a keyed list should be getting used by most Inferno users and has been encouraging a keyed list wherever possible due to state in items/DOM nodes. After evaluating whether we could determine using HTTP Archive or other data analysis means whether we could find out what folks are actually doing, there isn't a clean way of accomplishing this due to the obfuscation that comes with minifying JS. With this in mind, my recommendation is that we land this patch to use the keyed algorithm based on what limited information we have available that suggests it is what Inferno users in the wild would be using.
Ryosuke Niwa
Comment 6
2017-09-27 14:50:05 PDT
We should probably add both variants given the huge 4x difference in the measured time.
Addy Osmani
Comment 7
2017-09-27 14:53:09 PDT
As we included two variants for one of the Ember cases, I'm fine with multiple variants for the Inferno case too. Shiyu Zhang, is this something you would be able to help with?
Shiyu Zhang
Comment 8
2017-09-30 02:15:22 PDT
Thanks for your information. I am a bit hesitant to implement the keyed algorithm Inferno into Speedometer along with non-keyed. Would it be more reasonable to use one keyed algorithm Inferno in Speedometer instead of including two variants of both keyed and non-keyed? Keys are highly recommended in React, Preact and any other virtual DOM library/framework when handling items in lists. This is clearly stated in the guide docs of Inferno, React and Preact. React will even give a warning that a key should be provided for list items in the console. Given that we have limited information on the Inferno users' choice in the wild world, would it be more reasonable to assume that most web developers have good will to follow the suggestion to use keyed lists? As the Inferno author also confirmed that a keyed list should be getting used by most Inferno users. If that's the case, it makes more sense to keep just keyed algorithm and removes the non-keyed implementation, doesn't it? Besides, as we have observed via Chrome Performance tool, the bottleneck of Inferno case is the horrible large changes in DOM tree and layout thrashing caused by non-keyed algorithm. Other than blaming the web engine for this, maybe it's more reasonable to educate the web developers to avoid codes that causes layout thrashing like non-keyed lists. Thus, including a non-keyed Inferno case in Speedometer seems to have little practical value in guiding browsers to optimize their web engine when the major performance loss lies on the misuse of non-keyed lists. Meanwhile, the time of running the benchmark was also enlarged by duplicated Ember and Inferno cases, it would be more than appreciated to have the duplicated ones removed, keep the benchmark clean and neat, and reduce the total time of the benchmark execution.
Ryosuke Niwa
Comment 9
2017-09-30 02:30:48 PDT
Shiyu, with all due respect, you're misunderstanding the intent of Speedometer benchmark. The goal of Speedometer benchmark is to measure real world performance, not the highly optimized content on Web. If there's some web content that's slow, that's exactly what we'd like to test in the benchmark. (In reply to Shiyu Zhang from
comment #8
)
> Thanks for your information. I am a bit hesitant to implement the keyed > algorithm Inferno into Speedometer along with non-keyed. Would it be more > reasonable to use one keyed algorithm Inferno in Speedometer instead of > including two variants of both keyed and non-keyed?
No.
> Keys are highly recommended in React, Preact and any other virtual DOM > library/framework when handling items in lists. This is clearly stated in > the guide docs of Inferno, React and Preact. React will even give a warning > that a key should be provided for list items in the console. Given that we > have limited information on the Inferno users' choice in the wild world, > would it be more reasonable to assume that most web developers have good > will to follow the suggestion to use keyed lists?
We do have a very important information: Inferno supports non-keyed algorithm. It means that any real website can end up deploying Inferno with non-keyed algorithm. In fact, Inferno example in TodoMVC currently included in Speedometer 2.0 DID use the non-keyed algorithm!
> As the Inferno author also > confirmed that a keyed list should be getting used by most Inferno users. If > that's the case, it makes more sense to keep just keyed algorithm and > removes the non-keyed implementation, doesn't it?
Absolutely not. The goal of Speedometer isn't to measure the performance of well behaving or even well written Web apps. It is to measure the performance of real Web applications. If there is some pathology that a library/framework user could encounter, then that test case should certainly be included in Speedometer.
> Besides, as we have observed via Chrome Performance tool, the bottleneck of > Inferno case is the horrible large changes in DOM tree and layout thrashing > caused by non-keyed algorithm.
Given that this could happen in real life, and it DID happen in real life, it's of utmost interests to us to test non-keyed version of Inferno. In fact, I'd even argue that keyed algorithm is less variable as that's already fast in many browsers.
> Other than blaming the web engine for this, > maybe it's more reasonable to educate the web developers to avoid codes that > causes layout thrashing like non-keyed lists. Thus, including a non-keyed > Inferno case in Speedometer seems to have little practical value in guiding > browsers to optimize their web engine when the major performance loss lies > on the misuse of non-keyed lists.
Absolutely not.
> Meanwhile, the time of running the benchmark was also enlarged by duplicated > Ember and Inferno cases, it would be more than appreciated to have the > duplicated ones removed, keep the benchmark clean and neat, and reduce the > total time of the benchmark execution.
First off, the runtime increase caused by Inferno is negligible. Even if it were, that would be an argument for not including the keyed version of Inferno. If some test case is so slow that it's causing a problem in a benchmark, it's surely going to cause a bad user experience in real life.
Ryosuke Niwa
Comment 10
2017-10-25 22:45:47 PDT
Closing this bug as WontFix for now since there has been no response for almost one entire month yet we need to finalize Speedometer 2.0 at some point.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug