[clang] [clang][Lex] Replace push_back with emplace_back for vector insertions (PR #232260)

Hardik Kumar via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 22 03:18:54 PDT 2026


hardikxk wrote:

> Could you clarify the expected benefit of this change? In particular, I'm not sure that adding a constructor solely to enable emplace_back is worthwhile here. Do you have any measurements showing a performance improvement?

Motivated solely from the FIXME in the code and yes the performance should not really be much as the seen from usual benchmarks of `emplace_back()` vs `push_back()` but I believe it would be better to use `emplace_back` where it makes sense for its benefits

I can try to get some performance benchmarks for this change in a while as I'm currently not sure how to benchmark this

https://github.com/llvm/llvm-project/pull/232260


More information about the cfe-commits mailing list