<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/follow-up-resize-assign-is-often-faster-than-reserve-emplace-back-for-vector-nusmzcdfu" -->

---
title: Follow up: resize + assign is often faster than reserve...
description: A follow-up benchmarking study comparing two strategies for populating std::vector in C++: resize+assign vs reserve+emplace_back. Using GCC 13.2, resize+assign...
canonical: https://daily.dev/posts/follow-up-resize-assign-is-often-faster-than-reserve-emplace-back-for-vector-nusmzcdfu
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Follow up: resize + assign is often faster than reserve + emplace_back for vector | daily.dev
og:description: A follow-up benchmarking study comparing two strategies for populating std::vector in C++: resize+assign vs reserve+emplace_back. Using GCC 13.2, resize+assign...
og:url: https://daily.dev/posts/follow-up-resize-assign-is-often-faster-than-reserve-emplace-back-for-vector-nusmzcdfu
og:image: https://api.daily.dev/og/posts/NUSMzcdFU.png
og:image:alt: Follow up: resize + assign is often faster than reserve + emplace_back for vector
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Follow up: resize + assign is often faster than reserve + emplace_back for vector

**[Meeting C\+\+](https://daily.dev/sources/meetingcpp)** · 2 min read · 1 upvotes · 0 comments

## Summary

A follow-up benchmarking study comparing two strategies for populating std::vector in C++: resize+assign vs reserve+emplace_back. Using GCC 13.2, resize+assign is consistently faster — up to 1.9x for size_t and 1.6x for a struct of four size_t values. With Clang+libc++, similar gains appear, with up to 2.1x speedup for size_t. The advantage persists even in growing-vector scenarios for smaller data types, though it diminishes for larger structs. The conclusion is that resize+assign is a viable optimization strategy worth testing in code that fills vectors in bulk.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.meetingcpp.com/blog/items/Follow-up--resize-p-assign-is-often-faster-than-reserve-p-emplace-back-for-vector.html>

## Similar posts on daily.dev

- [Is resize \+ assign faster then reserve \+ emplace\_back for vector?](https://daily.dev/posts/is-resize-assign-faster-then-reserve-emplace-back-for-vector--af1k8eqai) · Meeting C\+\+ · 3 upvotes · 0 comments
- [C\+\+26: std::inplace\_vector](https://daily.dev/posts/c-26-std-inplace-vector-9a9stjxez) · Sandor Dargo · 2 upvotes · 0 comments
- [Implementing vector](https://daily.dev/posts/implementing-vector-b9b7cs263) · C\+\+ · 4 upvotes · 0 comments
- [Part 1: std::inplace\_vector — The Fixed-Capacity Vector Finally Comes to C\+\+26](https://daily.dev/posts/part-1-std-inplace-vector-the-fixed-capacity-vector-finally-comes-to-c-26-obybukog4) · Towards Dev · 0 upvotes · 0 comments
- [Does bulk memmove speed up std::remove\_if? \(No.\)](https://daily.dev/posts/does-bulk-memmove-speed-up-std-remove-if-no--rzbos9ewk) · Arthur O'Dwyer · 0 upvotes · 0 comments

---

Tags: [#c++](https://daily.dev/tags/c++), [#performance](https://daily.dev/tags/performance)

[View this post on daily.dev](https://daily.dev/posts/follow-up-resize-assign-is-often-faster-than-reserve-emplace-back-for-vector-nusmzcdfu)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Follow up: resize + assign is often faster than reserve + emplace_back for vector","url":"https://daily.dev/posts/follow-up-resize-assign-is-often-faster-than-reserve-emplace-back-for-vector-nusmzcdfu","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/follow-up-resize-assign-is-often-faster-than-reserve-emplace-back-for-vector-nusmzcdfu"},"datePublished":"2026-03-05T14:43:40.058Z","dateModified":"2026-03-15T05:58:37.686Z","description":"A follow-up benchmarking study comparing two strategies for populating std::vector in C++: resize+assign vs reserve+emplace_back. Using GCC 13.2, resize+assign...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/340494f18f79994efe840f461100a678?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/340494f18f79994efe840f461100a678?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Meeting C++","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Meeting C++","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/49c7b6c7e0084e94bdd54fcf01f0ae53","url":"https://daily.dev/sources/meetingcpp"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/follow-up-resize-assign-is-often-faster-than-reserve-emplace-back-for-vector-nusmzcdfu","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"c++,performance","timeRequired":"PT2M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Meeting C++","item":"https://daily.dev/sources/meetingcpp"},{"@type":"ListItem","position":3,"name":"Follow up: resize + assign is often faster than reserve + emplace_back for vector"}]}
```

