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

Unified Diff: runtime/vm/benchmark_test.cc

Issue 12226068: Add snapshot size to the VM benchmarks suite. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 10 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
« no previous file with comments | « runtime/bin/dartutils.cc ('k') | runtime/vm/unit_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/benchmark_test.cc
===================================================================
--- runtime/vm/benchmark_test.cc (revision 18232)
+++ runtime/vm/benchmark_test.cc (working copy)
@@ -390,4 +390,68 @@
benchmark->set_score(elapsed_time);
}
+
+static uint8_t* malloc_allocator(
+ uint8_t* ptr, intptr_t old_size, intptr_t new_size) {
+ return reinterpret_cast<uint8_t*>(realloc(ptr, new_size));
+}
+
+
+BENCHMARK(CoreSnapshotSize) {
+ const char* kScriptChars =
+ "import 'dart:async';\n"
+ "import 'dart:core';\n"
+ "import 'dart:collection';\n"
+ "import 'dart:_collection-dev';\n"
+ "import 'dart:math';\n"
+ "import 'dart:isolate';\n"
+ "import 'dart:mirrors';\n"
+ "import 'dart:scalarlist';\n"
+ "\n";
+
+ // Start an Isolate, load a script and create a full snapshot.
+ uint8_t* buffer;
+ TestCase::LoadTestScript(kScriptChars, NULL);
+ Api::CheckIsolateState(Isolate::Current());
+
+ // Write snapshot with object content.
+ FullSnapshotWriter writer(&buffer, &malloc_allocator);
+ writer.WriteFullSnapshot();
+ const Snapshot* snapshot = Snapshot::SetupFromBuffer(buffer);
+ ASSERT(snapshot->kind() == Snapshot::kFull);
+ benchmark->set_score(snapshot->length());
+}
+
+
+BENCHMARK(StandaloneSnapshotSize) {
+ const char* kScriptChars =
+ "import 'dart:async';\n"
+ "import 'dart:core';\n"
+ "import 'dart:collection';\n"
+ "import 'dart:_collection-dev';\n"
+ "import 'dart:math';\n"
+ "import 'dart:isolate';\n"
+ "import 'dart:mirrors';\n"
+ "import 'dart:scalarlist';\n"
+ "import 'dart:uri';\n"
+ "import 'dart:utf';\n"
+ "import 'dart:json';\n"
+ "import 'dart:crypto';\n"
+ "import 'dart:builtin';\n"
+ "import 'dart:io';\n"
+ "\n";
+
+ // Start an Isolate, load a script and create a full snapshot.
+ uint8_t* buffer;
+ TestCase::LoadTestScript(kScriptChars, NULL);
+ Api::CheckIsolateState(Isolate::Current());
+
+ // Write snapshot with object content.
+ FullSnapshotWriter writer(&buffer, &malloc_allocator);
+ writer.WriteFullSnapshot();
+ const Snapshot* snapshot = Snapshot::SetupFromBuffer(buffer);
+ ASSERT(snapshot->kind() == Snapshot::kFull);
+ benchmark->set_score(snapshot->length());
+}
+
} // namespace dart
« no previous file with comments | « runtime/bin/dartutils.cc ('k') | runtime/vm/unit_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698