-
- Downloads
c++: Small make_tree_vector_from_ctor improvement
After committing the append_ctor_to_tree_vector patch, I've realized that for the larger constructors make_tree_vector_from_ctor unnecessarily wastes one GC vector; make_tree_vector () / release_tree_vector () only caches GC vectors from 4 to 16 allocated tree elements, so in the likely case of a rather small ctor using make_tree_vector () can be beneficial, we can pick something from the cache and if we don't need it later, pt.cc calls release_tree_vector on it to return it back to the cache. But for the larger ctors, we just eat one vector from the cache, never use it (because the vec_safe_reserve will immediately allocate a different vector) and never return it back to the cache. So, the following patch passes NULL for the larger vectors, which append_ctor_to_tree_vector handles just fine now (vec_safe_reserve will just allocate appropriately sized vector). 2025-01-23 Jakub Jelinek <jakub@redhat.com> * c-common.cc (make_tree_vector_from_ctor): Only use make_tree_vector for ctors with <= 16 elements.
Loading
Please register or sign in to comment