OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 6251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6262 TEST(HeapTest, MixinConstructionNoGC) | 6262 TEST(HeapTest, MixinConstructionNoGC) |
6263 { | 6263 { |
6264 Persistent<ClassWithMember> object = ClassWithMember::create(); | 6264 Persistent<ClassWithMember> object = ClassWithMember::create(); |
6265 EXPECT_EQ(0, object->traceCount()); | 6265 EXPECT_EQ(0, object->traceCount()); |
6266 TestMixinAllocatingObject* mixin = TestMixinAllocatingObject::create(object. get()); | 6266 TestMixinAllocatingObject* mixin = TestMixinAllocatingObject::create(object. get()); |
6267 EXPECT_TRUE(mixin); | 6267 EXPECT_TRUE(mixin); |
6268 EXPECT_GT(object->traceCount(), 0); | 6268 EXPECT_GT(object->traceCount(), 0); |
6269 EXPECT_GT(mixin->traceCount(), 0); | 6269 EXPECT_GT(mixin->traceCount(), 0); |
6270 } | 6270 } |
6271 | 6271 |
6272 TEST(HeapTest, PersistentPerfTest) | |
haraken
2015/06/29 11:48:52
This is a micro-benchmark to measure the performan
| |
6273 { | |
6274 const int count = 10000; | |
6275 int sum = 0; | |
6276 Persistent<IntWrapper>** handle = static_cast<Persistent<IntWrapper>**>(mall oc(sizeof(Persistent<IntWrapper>*) * count)); | |
6277 double begin = WTF::currentTimeMS(); | |
6278 for (int i = 0; i < count; i++) { | |
6279 handle[i] = new Persistent<IntWrapper>(IntWrapper::create(i)); | |
6280 } | |
6281 for (int delta = 2; delta < 100; delta++) { | |
6282 for (int i = 0; i < count; i+=delta) { | |
6283 sum += handle[i]->get()->value(); | |
6284 delete handle[i]; | |
6285 } | |
6286 for (int i = 0; i < count; i+=delta) { | |
6287 handle[i] = new Persistent<IntWrapper>(IntWrapper::create(i)); | |
6288 } | |
6289 } | |
6290 for (int i = 0; i < count; i++) { | |
6291 sum += handle[i]->get()->value(); | |
6292 delete handle[i]; | |
6293 } | |
6294 double end =WTF::currentTimeMS(); | |
6295 fprintf(stderr, "%.2lf %d\n", end - begin, sum); | |
6296 } | |
6297 | |
6272 } // namespace blink | 6298 } // namespace blink |
OLD | NEW |