Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1889)

Unified Diff: Source/platform/heap/HeapTest.cpp

Issue 1213133002: Oilpan: Reduce sizeof(Persistent) to 16 byte (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698