eteran / c-vector

A dynamic array implementation in C similar to the one found in standard C++
MIT License
737 stars 109 forks source link

Performance VS std::vector #72

Closed jordan4ibanez closed 1 month ago

jordan4ibanez commented 1 month ago

As I cannot find any benchmarking information I thought I'd simply ask.

What is the performance like in comparison to C++ std::vector?

eteran commented 1 month ago

In general, the performance should be comparable to that of std::vector since it uses what is essentially the same strategies. That is:

O(1) element access

Amortized constant performance for push_back (meaning that it will usually not need to resize the array, but will sometimes need to, in which case, there is a O(n) cost to adjusting capacity.