3 ms·
> This extra level of indirection on every container is very costly in V8 and Ion. It is very costly only if JIT is particularly bad at eliminating redundancie
by mraleph 13y ago
> This extra level of indirection on every container is very costly in V8 and Ion.
It is very costly only if JIT is particularly bad at eliminating redundancies. Crankshaft is not and (I hope) neither is IonMonkey.
If you try removing it yourself from JavaScript version and replace every new OrderedCollection() with [], .add with .push, and so on then you will discover to your amazement that resulting code became 7-10% slower on V8 [try it, I am not joking :-)]
Now if you replace [] with new Array() then you get code that overall is 3-5% faster on V8. That is about how "costly" this indirection is.
Overall it seems that this is irrelevant in the large picture of things: Dart VM is around 195% of V8, dart2js is somewhere around 100%.
I do agree however that this OrderedCollection looks completely out of place and it is not clear to me why it appeared in the original JavaScript benchmark code at the first place. It is not idiomatic.
- bsdetector 13y ago> you will discover to your amazement that resulting code became 7-10% slower on V8 I found both V8 and Ion to be >10% faster using array. I no longer have the results but IIRC it was 11% for V8 and 14% for Ion on i7 (ivy bridge). I moved remove() from OrderedCollection to Array prototype. Perhaps you made some other change. > Overall it seems that this is irrelevant in the large picture of things: Dart VM is around 195% of V8, There are 3 benchmarks. That is not enough data to say anything meaningful about Dart VM performance. > dart2js is somewhere around 100%. How can dart2js results be compared to the original JS if the data structures used are different? It makes no sense.
- mraleph 13y ago> Perhaps you made some other change. I tried with both global remove and remove on the Array prototype. V8 has recently improved DeltaBlue score by, I think, ~6% so it can be that before this improvement OrderedCollection overhead was more noticeable. (some of that improvement comes from tweaks in the inlining heuristics AFAIK). > There are 3 benchmarks. I was stating performance numbers for DeltaBlue only. Sorry for not being clear. > How can dart2js results be compared to the original JS if the data structures used are different? Substract 5%. dart2js is around 95%. Does it make sense now?