Trong mã nguồn Carbon, thay .resize() bằng .reserve() giảm thời gian cấp phát bộ nhớ từ 194 ms xuống 3.3 ms, mang lại tăng tốc đáng kể cho các đơn vị dịch lớn. #Performance #CarbonLang #C++ #TốiƯuHóa #LậpTrình

Optimize ValueStore::Reserve to use lazy allocation by wilkolbrzym-coder · Pull Request #6656 · carbon-language/carbon-lang
Changed ValueStore::Reserve to use chunks_.reserve instead of chunks_.resize. This avoids eager construction of Chunk objects (which allocate 4KB buffers) when reserving capacity. Chunks are now in...
