Niels Lohmann
49ea918969
Unflatten in time and memory linear in the pointer depth
...
#5443 made unflatten() decide between arrays and objects independently
of the iteration order by collecting the pointer prefixes that have a
reference token 0 below them in a std::set<std::vector<string_t>>.
Every such prefix was stored as a copy of all its reference tokens, and
get_and_create() compared whole prefix vectors at every step, so
unflattening a pointer of depth d took time and memory quadratic in d:
a 10,000-level array pointer took 18 s and 1.3 GB, a 100,000-level one
did not finish.
The prefixes are now numbered nodes of a tree, so each is stored once
and get_and_create() follows the tree token by token. The result is
unchanged, including its independence of the iteration order.
Signed-off-by: Niels Lohmann <mail@nlohmann.me >
2026-10-09 09:49:05 +02:00
..
2026-01-01 20:00:39 +01:00
2026-10-07 08:50:12 +02:00
2026-10-07 08:50:12 +02:00
2026-10-07 08:50:12 +02:00
2026-10-07 08:50:12 +02:00
2026-10-07 08:50:12 +02:00
2026-10-07 08:50:12 +02:00
2026-10-07 08:50:12 +02:00
2026-01-01 20:00:39 +01:00
2026-10-01 07:33:07 +02:00
2026-10-01 07:33:07 +02:00
2026-09-16 20:15:46 +02:00
2026-10-06 22:53:03 +02:00
2026-10-01 07:33:07 +02:00
2026-07-08 16:40:58 +02:00
2026-10-08 16:11:16 +02:00
2026-10-06 22:33:29 +02:00
2026-10-01 07:37:47 +02:00
2026-10-08 16:11:16 +02:00
2026-10-04 17:18:19 +02:00
2026-10-04 17:18:19 +02:00
2026-10-01 07:37:47 +02:00
2026-10-07 19:17:18 +02:00
2026-10-04 22:11:34 +02:00
2026-10-07 07:39:05 +02:00
2026-10-07 08:50:12 +02:00
2026-09-16 20:15:46 +02:00
2026-10-01 07:37:47 +02:00
2026-10-07 07:38:52 +02:00
2026-09-27 14:19:22 +02:00
2026-01-01 20:00:39 +01:00
2026-10-08 08:49:32 +02:00
2026-10-06 08:36:40 +02:00
2026-10-08 16:11:16 +02:00
2026-01-01 20:00:39 +01:00
2026-09-30 20:07:52 +02:00
2026-10-02 11:23:55 +02:00
2026-09-11 08:22:50 +02:00
2026-10-04 17:18:19 +02:00
2026-10-06 07:22:55 +02:00
2026-10-08 16:11:16 +02:00
2026-10-06 22:33:29 +02:00
2026-09-27 16:56:21 +02:00
2026-10-08 16:11:16 +02:00
2026-10-06 07:22:55 +02:00
2026-10-04 22:11:34 +02:00
2026-09-30 21:36:04 +02:00
2026-10-07 16:37:19 +02:00
2026-10-02 11:23:55 +02:00
2026-09-30 20:53:56 +02:00
2026-10-04 17:18:19 +02:00
2026-09-30 20:07:06 +02:00
2026-10-06 07:22:55 +02:00
2026-10-04 17:54:05 +02:00
2026-10-04 17:54:05 +02:00
2026-09-27 16:56:21 +02:00
2026-07-02 15:59:36 +02:00
2026-10-08 16:11:16 +02:00
2026-01-01 20:00:39 +01:00
2026-09-09 09:52:58 +02:00
2026-10-04 22:11:34 +02:00
2026-01-01 20:00:39 +01:00
2026-10-01 07:33:07 +02:00
2026-01-01 20:00:39 +01:00
2026-10-01 07:37:47 +02:00
2026-10-09 09:49:05 +02:00
2026-10-08 16:11:16 +02:00
2026-10-08 16:11:16 +02:00
2026-10-01 07:37:47 +02:00
2026-01-01 20:00:39 +01:00
2026-10-04 17:18:19 +02:00
2026-10-06 22:53:03 +02:00
2026-10-08 16:11:16 +02:00
2026-09-30 20:08:17 +02:00
2026-09-16 20:15:46 +02:00
2026-09-09 09:48:17 +02:00
2026-09-16 20:15:46 +02:00
2026-10-02 17:25:17 +02:00
2026-09-27 16:56:21 +02:00
2026-10-04 11:46:25 +02:00
2026-10-04 17:18:19 +02:00
2026-10-02 11:23:55 +02:00
2026-10-01 07:37:47 +02:00
2026-10-01 07:33:07 +02:00
2026-01-01 20:00:39 +01:00
2026-10-08 16:11:16 +02:00
2026-10-08 16:11:16 +02:00
2026-10-08 16:11:16 +02:00
2026-10-08 16:11:16 +02:00
2026-09-27 14:19:22 +02:00
2026-01-01 20:00:39 +01:00
2026-01-01 20:00:39 +01:00
2026-10-04 11:50:42 +02:00
2026-10-07 08:50:12 +02:00
2026-01-01 20:00:39 +01:00
2026-09-25 20:44:30 +02:00
2026-10-06 22:33:29 +02:00
2026-10-07 19:17:57 +02:00
2026-10-01 07:37:47 +02:00
2026-01-01 20:00:39 +01:00
2026-10-04 17:18:19 +02:00
2026-09-30 22:49:24 +02:00
2026-10-01 07:37:47 +02:00