Chromium Code Reviews| Index: Source/platform/heap/HeapTest.cpp |
| diff --git a/Source/platform/heap/HeapTest.cpp b/Source/platform/heap/HeapTest.cpp |
| index f5e2d275da575e08cfd551cc608fb5691fc76996..2cf6309ed614ca0c27645efba68545bc69854f56 100644 |
| --- a/Source/platform/heap/HeapTest.cpp |
| +++ b/Source/platform/heap/HeapTest.cpp |
| @@ -6269,4 +6269,30 @@ TEST(HeapTest, MixinConstructionNoGC) |
| EXPECT_GT(mixin->traceCount(), 0); |
| } |
| +TEST(HeapTest, PersistentPerfTest) |
|
haraken
2015/06/29 11:48:52
This is a micro-benchmark to measure the performan
|
| +{ |
| + const int count = 10000; |
| + int sum = 0; |
| + Persistent<IntWrapper>** handle = static_cast<Persistent<IntWrapper>**>(malloc(sizeof(Persistent<IntWrapper>*) * count)); |
| + double begin = WTF::currentTimeMS(); |
| + for (int i = 0; i < count; i++) { |
| + handle[i] = new Persistent<IntWrapper>(IntWrapper::create(i)); |
| + } |
| + for (int delta = 2; delta < 100; delta++) { |
| + for (int i = 0; i < count; i+=delta) { |
| + sum += handle[i]->get()->value(); |
| + delete handle[i]; |
| + } |
| + for (int i = 0; i < count; i+=delta) { |
| + handle[i] = new Persistent<IntWrapper>(IntWrapper::create(i)); |
| + } |
| + } |
| + for (int i = 0; i < count; i++) { |
| + sum += handle[i]->get()->value(); |
| + delete handle[i]; |
| + } |
| + double end =WTF::currentTimeMS(); |
| + fprintf(stderr, "%.2lf %d\n", end - begin, sum); |
| +} |
| + |
| } // namespace blink |