-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
About the benchmark #15
Comments
I wouldn't worry about that, there are some natural fluctuations when running the benchmarks, so even if the benchmark hasn't changed at all the numbers will go slightly up and down. For that same reason, I also wouldn't worry about minor differences. As for the ratios, dominator takes Meanwhile, Yew takes |
Yes I know that. How many times did you run the benchmark? In other words, what is the value of N in the command below?
If N>=10, I don't think the slowdown ~20% is slightly! Especially for the
Actually, the slowdown is 126/418 = 30%.
I know that Yew is not great in absolute numbers! But the its ratio is normal, it is consistent. Creating 10,000 rows vs 1,000 rows just different in the count, we call the same function with different arg's value! (That said, I will not choose Yew in this case just because it is more consistent 😁 ) It's worth to note that the ratio of (2)/(1) of Dominator v0.4.4 is also ~13. And more, both Dominator v0.4.4 and Yew bases on stdweb! |
I used As for the ratios, I'm not worried about that, they're all low, and they're all similar to each other. Like I said, minor differences aren't worth worrying about. That's why performance is often described in big-O notation. If you find a specific area (such as a data structure or algorithm) where performance can be improved, I'd be very interested in hearing about that (I care an awful lot about performance). But I'm not going to fret over minor fluctuations in a synthetic benchmark, especially since all the frameworks have radically different implementation strategies and optimizations and tuning. For example, the Yew benchmark doesn't use keys, so it doesn't need to keep track of the DOM nodes. That makes it faster, but it causes various problems. Meanwhile, dominator has to keep track of the state of each individual DOM node (such as the Signals which that DOM node is using), and that also means it has to spawn 20,000 Tasks (which involves heap allocation and waiting for the next microtask queue). That adds a small amount of unavoidable overhead. |
To be clear, while I was creating the benchmark, I went over dominator with a fine-toothed-comb looking for any areas where I could improve its performance, and I made a lot of improvements to dominator's performance while doing so. And I used the browser's profiling tools extensively to pinpoint areas which needed to be improved (such as UTF-8 decoding and the JS GC), and then I fixed them. So at this point dominator is quite close to optimal in terms of performance. Any performance improvements will either require radical data structure/algorithm changes, or improvements to the underlying system (wasm-bindgen, WebIDL, the DOM, the Futures Executor, etc.) |
How about introducing
Introducing
So, put Yew aside. Just consider the one framework - Dominator v0.5 vs v0.4.4 - just different in based library, the benchmark implemented by the same person. There is some improvements from v0.4.4 to v0.5, which is good. And:
I think that it only applies to Dominator v0.5. Another fact is that wasm-bindgen 0.2.47 is the same or better than stdweb 0.4.17 in every benchmarks. But there is still some minor fluctuations that cause it to slowdown by 30% is a weird fact. Are you interested in re-run the benchmark to see if the situation stay the same or there will be some fluctuations that cause v0.5 win against v0.4.4 (especially on partial update)? |
Adding in a swap method wouldn't improve the performance, because the DOM does not have a "swap two DOM nodes" API. Moving things around in Rust is very fast, it's the DOM that's the problem. The DOM is many thousands of times slower than Rust. So making Rust a couple nanoseconds faster won't really help. The All of the other benchmarks (including However, now that you mention it, I think I can optimize
No, it isn't weird. That's completely normal. As I have said, benchmarks naturally fluctuate, even when you run the exact same benchmark multiple times. Since you don't seem to believe me, I recommend running some web app benchmarks yourself, on your own computer, so you can see.
I had spent several hours re-running the benchmark dozens of times (with It's not like I ran it one time and said "okay that's it, perfect, let's just post that one". Every time I made a tiny tweak to dominator to improve the performance I re-ran the benchmarks. I also re-ran the benchmarks multiple times even when I hadn't changed anything. I also re-ran the benchmarks for the other frameworks too. Even when the dominator benchmark was officially accepted they got very different results. Notice how it's faster for everything except the "append 10,000 rows" benchmark. There's so many things that affect the benchmark performance: your OS, your browser, any background programs that are running, GC, JIT, internal browser data structures, the multiple layers of CPU caches, the multiple layers of RAM caches, the multiple layers of filesystem caches, the multiple layers of browser caches, the application caches, etc. That's why I keep saying that it isn't a big deal. That's why I keep saying that minor fluctuations should be completely ignored, because they are useless noise, they don't actually indicate a performance problem. I've benchmarked many JS programs over the years, so I'm speaking from experience. |
So, I guess adding it (not for performance) just because:
It's not about believe or not believe in the person I am talking to. Discussions are for understanding facts (we may find out some truths - or something similar 😁 - behind them).
I think you want to say about Any way, I will close this because it does not lead to anything useful. I am sorry for the annoyance this bring to you. Thank you for all the patient answers you gave. |
I agree that adding a |
Hmm... sorry for opening this issue here. It's not about Dominator, just bring up by Dominator.
I saw Dominator's benchmark on Rust+Wasm news.
wasm-bindgen slower in some benchmarks
There are some benchmarks where Dominator v0.5 slower than v0.4.4:
What do you think about these? Are there problems with wasm-bindgen?
Creating 10,000 vs 1,000 rows:
The ratio of Dominator is not good, but the ratio of Yew is perfectly normal?
The text was updated successfully, but these errors were encountered: