Traverse Test¶
We compared the time consumption of traversing the container in vector_pro and std::vector with different element sizes and quantities.
Test Code¶
See the full code at traverse_test .
We used three different element sizes (small, medium, large) for testing, with the number of elements ranging from 1 to 901, increasing by 100 for each test.
To ensure the reliability of the test results in each scenario, we conducted 20 tests for each container and took the average. In the first 10 tests, vector_pro started first, while in the latter 10 tests, std::vector started first.
The traversal test was done using
iterator_proandstd::iteratorrather than direct indexing.
Result¶
The test results are as follows: as the number of elements in the container increase, the traversal time for both vector_pro and std::vector also increases linearly. However, due to differences in data structure, the traversal time for vector_pro is slightly higher than that for std::vector. Nonetheless, this difference becomes less noticeable as the element size increases.

You can find detailed information on each test element, the time measurement functions used, and the system specifications under the project's directory.