Linus Groh
a82c56f9f7
LibJS: Speed up IndexedPropertyIterator by computing non-empty indices
...
This provides a huge speed-up for objects with large numbers as property
keys in some situation. Previously we would simply iterate from 0-<max>
and check if there's a non-empty value at each index - now we're being
smarter and compute a list of non-empty indices upfront, by checking
each value in the packed elements vector and appending the sparse
elements hashmap keys (for GenericIndexedPropertyStorage).
Consider this example, an object with a single own property, which is a
number increasing by a factor of 10 each iteration:
for (let i = 0; i < 10; ++i) {
const o = {[10 ** i]: "foo"};
const start = Date.now();
Object.getOwnPropertyNames(o); // <-- IndexedPropertyIterator
const end = Date.now();
console.log(`${10 ** i} -> ${(end - start) / 1000}s`);
}
Before this change:
1 -> 0.0000s
10 -> 0.0000s
100 -> 0.0000s
1000 -> 0.0000s
10000 -> 0.0005s
100000 -> 0.0039s
1000000 -> 0.0295s
10000000 -> 0.2489s
100000000 -> 2.4758s
1000000000 -> 25.5669s
After this change:
1 -> 0.0000s
10 -> 0.0000s
100 -> 0.0000s
1000 -> 0.0000s
10000 -> 0.0000s
100000 -> 0.0000s
1000000 -> 0.0000s
10000000 -> 0.0000s
100000000 -> 0.0000s
1000000000 -> 0.0000s
Fixes #3805 .
2020-10-20 08:51:41 +02:00
..
2020-09-27 20:26:58 +02:00
2020-10-13 23:57:45 +02:00
2020-09-27 20:26:58 +02:00
2020-10-13 23:57:45 +02:00
2020-09-27 20:26:58 +02:00
2020-09-25 21:18:17 +02:00
2020-09-08 16:20:34 +02:00
2020-10-13 23:57:45 +02:00
2020-07-23 17:31:08 +02:00
2020-10-13 23:57:45 +02:00
2020-07-23 17:31:08 +02:00
2020-09-27 20:26:58 +02:00
2020-10-06 18:37:58 +02:00
2020-10-13 23:57:45 +02:00
2020-09-27 20:26:58 +02:00
2020-09-27 20:26:58 +02:00
2020-06-21 15:15:52 +02:00
2020-10-13 23:57:45 +02:00
2020-07-23 17:31:08 +02:00
2020-10-13 23:57:45 +02:00
2020-09-27 20:26:58 +02:00
2020-09-27 20:26:58 +02:00
2020-06-21 15:15:52 +02:00
2020-10-13 23:57:45 +02:00
2020-07-23 17:31:08 +02:00
2020-10-13 23:57:45 +02:00
2020-10-04 17:03:33 +02:00
2020-10-04 17:03:33 +02:00
2020-10-04 17:03:33 +02:00
2020-10-14 00:10:49 +02:00
2020-10-14 00:10:49 +02:00
2020-07-23 17:31:08 +02:00
2020-09-27 20:26:58 +02:00
2020-10-04 19:22:02 +02:00
2020-10-13 23:57:45 +02:00
2020-09-27 20:26:58 +02:00
2020-10-13 23:57:45 +02:00
2020-09-25 21:18:17 +02:00
2020-10-13 23:57:45 +02:00
2020-06-21 15:15:52 +02:00
2020-10-13 23:57:45 +02:00
2020-09-27 20:26:58 +02:00
2020-10-13 23:57:45 +02:00
2020-09-25 21:18:17 +02:00
2020-09-25 21:18:17 +02:00
2020-10-04 19:22:02 +02:00
2020-10-13 23:57:45 +02:00
2020-09-27 20:26:58 +02:00
2020-10-13 23:57:45 +02:00
2020-10-04 17:03:33 +02:00
2020-10-13 23:57:45 +02:00
2020-09-27 20:26:58 +02:00
2020-10-13 23:57:45 +02:00
2020-07-23 17:31:08 +02:00
2020-10-17 23:47:07 +02:00
2020-10-17 23:23:53 +02:00
2020-10-20 08:51:41 +02:00
2020-10-20 08:51:41 +02:00
2020-10-13 23:57:45 +02:00
2020-09-08 14:15:13 +02:00
2020-09-27 20:26:58 +02:00
2020-07-23 17:31:08 +02:00
2020-10-14 00:10:49 +02:00
2020-09-27 20:26:58 +02:00
2020-09-29 16:41:28 +02:00
2020-09-29 16:41:28 +02:00
2020-09-08 13:43:03 +02:00
2020-09-08 13:43:03 +02:00
2020-10-13 23:57:45 +02:00
2020-07-23 17:31:08 +02:00
2020-10-04 17:03:33 +02:00
2020-10-04 17:03:33 +02:00
2020-09-27 20:26:58 +02:00
2020-09-27 20:26:58 +02:00
2020-10-16 17:06:57 +02:00
2020-09-27 20:26:58 +02:00
2020-09-27 20:26:58 +02:00
2020-07-15 18:24:55 +02:00
2020-10-14 00:10:49 +02:00
2020-07-23 17:31:08 +02:00
2020-10-17 23:47:07 +02:00
2020-10-17 23:23:53 +02:00
2020-10-13 23:57:45 +02:00
2020-09-27 20:26:58 +02:00
2020-10-13 23:57:45 +02:00
2020-07-23 17:31:08 +02:00
2020-09-27 20:26:58 +02:00
2020-09-27 20:26:58 +02:00
2020-06-06 22:13:01 +02:00
2020-09-25 21:18:17 +02:00
2020-10-08 10:02:47 +02:00
2020-10-13 23:57:45 +02:00
2020-09-27 20:26:58 +02:00
2020-10-13 23:57:45 +02:00
2020-09-27 20:26:58 +02:00
2020-09-27 20:26:58 +02:00
2020-06-21 15:15:52 +02:00
2020-10-04 19:22:02 +02:00
2020-09-29 16:45:39 +02:00
2020-10-13 23:57:45 +02:00
2020-07-23 17:31:08 +02:00
2020-10-13 23:57:45 +02:00
2020-09-27 20:26:58 +02:00
2020-10-04 19:22:02 +02:00
2020-06-21 15:15:52 +02:00
2020-09-27 20:26:58 +02:00
2020-06-21 15:15:52 +02:00
2020-10-17 23:23:53 +02:00
2020-10-04 17:03:33 +02:00
2020-10-17 23:47:07 +02:00
2020-10-16 16:46:27 +02:00
2020-10-13 23:57:45 +02:00
2020-09-27 20:26:58 +02:00
2020-09-25 21:18:17 +02:00
2020-07-13 15:07:29 +02:00
2020-10-13 23:57:45 +02:00
2020-07-23 17:31:08 +02:00
2020-09-27 20:26:58 +02:00
2020-06-21 15:15:52 +02:00
2020-10-15 23:49:53 +02:00
2020-10-13 23:57:45 +02:00
2020-07-23 17:31:08 +02:00
2020-09-27 20:26:58 +02:00
2020-10-04 19:22:02 +02:00
2020-10-13 23:57:45 +02:00
2020-09-27 20:26:58 +02:00
2020-09-27 20:26:58 +02:00
2020-07-09 23:29:28 +02:00
2020-10-13 23:57:45 +02:00
2020-07-23 17:31:08 +02:00
2020-10-13 23:57:45 +02:00
2020-06-21 15:15:52 +02:00
2020-10-13 23:57:45 +02:00
2020-10-02 18:01:27 +02:00
2020-10-13 23:57:45 +02:00
2020-10-13 23:57:45 +02:00