Commit 1ad52dc
committed
[RF] Don't recreate hash tables in
Thanks to #7818, where the `RooHashTable` was migrated to
`std::unordered_map`, we can now use proper `reserve()` functions to
increase the hash table size when adding elements.
The current mechanism deleting and recreating the hash tables from
scratch when the list size changed incurred a pretty large overhead.
In fact, it made adding to the list a `O(n)` operation, because it has
to iterate over the collection to fill the hash table again.
Consequently, copying a `RooLinkedList` was `O(n^2)`, which is
unexpected to the user.
This change will speed up the handling of objects in a RooWorkspace,
which uses `RooLinkedLists` to manage the elemens.RooLinkedList::Add()
1 parent 4429887 commit 1ad52dc
1 file changed
+14
-22
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
327 | 327 | | |
328 | 328 | | |
329 | 329 | | |
330 | | - | |
331 | | - | |
332 | | - | |
333 | | - | |
334 | | - | |
335 | | - | |
336 | | - | |
337 | | - | |
338 | | - | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
339 | 335 | | |
340 | 336 | | |
341 | 337 | | |
342 | | - | |
343 | | - | |
| 338 | + | |
| 339 | + | |
344 | 340 | | |
345 | | - | |
346 | | - | |
347 | | - | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
348 | 346 | | |
349 | | - | |
350 | | - | |
351 | | - | |
352 | | - | |
353 | | - | |
354 | | - | |
355 | | - | |
356 | | - | |
| 347 | + | |
| 348 | + | |
357 | 349 | | |
358 | 350 | | |
359 | 351 | | |
| |||
0 commit comments