1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:07:44 +00:00

Vector: Use TypedTransfer in more parts of Vector

Make more Vector-of-trivial-type operations go fast :^)
This commit is contained in:
Andreas Kling 2019-08-07 15:25:34 +02:00
parent e8e85f5457
commit 6da6ca64d2
2 changed files with 24 additions and 9 deletions

View file

@ -167,4 +167,18 @@ TEST_CASE(vector_compare)
EXPECT_EQ(strings, same_strings);
}
BENCHMARK_CASE(vector_append_trivial)
{
// This should be super fast thanks to Vector using memmove.
Vector<int> ints;
for (int i = 0; i < 1000000; ++i) {
ints.append(i);
}
for (int i = 0; i < 100; ++i) {
Vector<int> tmp;
tmp.append(ints);
EXPECT_EQ(tmp.size(), 1000000);
}
}
TEST_MAIN(Vector)