diff options
author | Bastien Montagne <bastien@blender.org> | 2021-06-30 16:19:35 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2021-07-27 15:53:49 +0300 |
commit | db4fe8e3223b36615e53cf64f4a55f6d974c4597 (patch) | |
tree | 91f97a9f26050ed889779a5f0dae86b460251c19 /source/blender/blenkernel/BKE_main_idmap.h | |
parent | e37c876cd77dd26d540597b3796621a4f22d1518 (diff) |
BlenRead: Add GHash-based search for already read linked IDs.
Ths commit adds a new `IDNameLibMap` to `Main`, used during file reading
to quickly find already read linked IDs.
Without that, search would use string-based search over list of linked
data, which becomes extremely slow and inneficient in cases where a lot
of IDs are linked from a same library. See also {T89194}.
Extrem-usecase reported in T89194 is now about 4 times faster in linked
data reading (about 2 times faster for the whole .blend file loading).
More normal cases (like Sprites studio production files) have barely
measurable speed improvements, a few percents at best.
NOTE: `main_idmap` API was extended to support insertion and removal of
IDs from the mapping, avoids having to re-create the whole thing several
time during libraries expansion in readcode.
Differential Revision: https://developer.blender.org/D11757
Diffstat (limited to 'source/blender/blenkernel/BKE_main_idmap.h')
-rw-r--r-- | source/blender/blenkernel/BKE_main_idmap.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_main_idmap.h b/source/blender/blenkernel/BKE_main_idmap.h index bffb12a5136..ff69883f0fb 100644 --- a/source/blender/blenkernel/BKE_main_idmap.h +++ b/source/blender/blenkernel/BKE_main_idmap.h @@ -50,8 +50,13 @@ struct IDNameLib_Map *BKE_main_idmap_create(struct Main *bmain, const int idmap_types) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); void BKE_main_idmap_destroy(struct IDNameLib_Map *id_map) ATTR_NONNULL(); + +void BKE_main_idmap_insert_id(struct IDNameLib_Map *id_map, struct ID *id) ATTR_NONNULL(); +void BKE_main_idmap_remove_id(struct IDNameLib_Map *id_map, struct ID *id) ATTR_NONNULL(); + struct Main *BKE_main_idmap_main_get(struct IDNameLib_Map *id_map) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); + struct ID *BKE_main_idmap_lookup_name(struct IDNameLib_Map *id_map, short id_type, const char *name, |