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

Side by Side Diff: runtime/vm/benchmark_test.cc

Issue 1123813002: Move symbol table from per isolate snapshot to vm isolate snapshot, this reduces the per isolate in… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/bin/snapshot_in.cc ('k') | runtime/vm/dart.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/benchmark_test.h" 5 #include "vm/benchmark_test.h"
6 6
7 #include "bin/builtin.h" 7 #include "bin/builtin.h"
8 #include "bin/file.h" 8 #include "bin/file.h"
9 9
10 #include "platform/assert.h" 10 #include "platform/assert.h"
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 uint8_t* buffer; 534 uint8_t* buffer;
535 Timer timer(true, "Serialize Null"); 535 Timer timer(true, "Serialize Null");
536 timer.Start(); 536 timer.Start();
537 for (intptr_t i = 0; i < kLoopCount; i++) { 537 for (intptr_t i = 0; i < kLoopCount; i++) {
538 StackZone zone(isolate); 538 StackZone zone(isolate);
539 MessageWriter writer(&buffer, &message_allocator, true); 539 MessageWriter writer(&buffer, &message_allocator, true);
540 writer.WriteMessage(null_object); 540 writer.WriteMessage(null_object);
541 intptr_t buffer_len = writer.BytesWritten(); 541 intptr_t buffer_len = writer.BytesWritten();
542 542
543 // Read object back from the snapshot. 543 // Read object back from the snapshot.
544 SnapshotReader reader(buffer, buffer_len, Snapshot::kMessage, isolate, 544 MessageSnapshotReader reader(buffer,
545 zone.GetZone()); 545 buffer_len,
546 isolate,
547 zone.GetZone());
546 reader.ReadObject(); 548 reader.ReadObject();
547 } 549 }
548 timer.Stop(); 550 timer.Stop();
549 int64_t elapsed_time = timer.TotalElapsedTime(); 551 int64_t elapsed_time = timer.TotalElapsedTime();
550 benchmark->set_score(elapsed_time); 552 benchmark->set_score(elapsed_time);
551 } 553 }
552 554
553 555
554 BENCHMARK(SerializeSmi) { 556 BENCHMARK(SerializeSmi) {
555 const Integer& smi_object = Integer::Handle(Smi::New(42)); 557 const Integer& smi_object = Integer::Handle(Smi::New(42));
556 const intptr_t kLoopCount = 1000000; 558 const intptr_t kLoopCount = 1000000;
557 Isolate* isolate = Isolate::Current(); 559 Isolate* isolate = Isolate::Current();
558 uint8_t* buffer; 560 uint8_t* buffer;
559 Timer timer(true, "Serialize Smi"); 561 Timer timer(true, "Serialize Smi");
560 timer.Start(); 562 timer.Start();
561 for (intptr_t i = 0; i < kLoopCount; i++) { 563 for (intptr_t i = 0; i < kLoopCount; i++) {
562 StackZone zone(isolate); 564 StackZone zone(isolate);
563 MessageWriter writer(&buffer, &message_allocator, true); 565 MessageWriter writer(&buffer, &message_allocator, true);
564 writer.WriteMessage(smi_object); 566 writer.WriteMessage(smi_object);
565 intptr_t buffer_len = writer.BytesWritten(); 567 intptr_t buffer_len = writer.BytesWritten();
566 568
567 // Read object back from the snapshot. 569 // Read object back from the snapshot.
568 SnapshotReader reader(buffer, buffer_len, Snapshot::kMessage, isolate, 570 MessageSnapshotReader reader(buffer,
569 zone.GetZone()); 571 buffer_len,
572 isolate,
573 zone.GetZone());
570 reader.ReadObject(); 574 reader.ReadObject();
571 } 575 }
572 timer.Stop(); 576 timer.Stop();
573 int64_t elapsed_time = timer.TotalElapsedTime(); 577 int64_t elapsed_time = timer.TotalElapsedTime();
574 benchmark->set_score(elapsed_time); 578 benchmark->set_score(elapsed_time);
575 } 579 }
576 580
577 581
578 BENCHMARK(SimpleMessage) { 582 BENCHMARK(SimpleMessage) {
579 const Array& array_object = Array::Handle(Array::New(2)); 583 const Array& array_object = Array::Handle(Array::New(2));
580 array_object.SetAt(0, Integer::Handle(Smi::New(42))); 584 array_object.SetAt(0, Integer::Handle(Smi::New(42)));
581 array_object.SetAt(1, Object::Handle()); 585 array_object.SetAt(1, Object::Handle());
582 const intptr_t kLoopCount = 1000000; 586 const intptr_t kLoopCount = 1000000;
583 Isolate* isolate = Isolate::Current(); 587 Isolate* isolate = Isolate::Current();
584 uint8_t* buffer; 588 uint8_t* buffer;
585 Timer timer(true, "Simple Message"); 589 Timer timer(true, "Simple Message");
586 timer.Start(); 590 timer.Start();
587 for (intptr_t i = 0; i < kLoopCount; i++) { 591 for (intptr_t i = 0; i < kLoopCount; i++) {
588 StackZone zone(isolate); 592 StackZone zone(isolate);
589 MessageWriter writer(&buffer, &malloc_allocator, true); 593 MessageWriter writer(&buffer, &malloc_allocator, true);
590 writer.WriteMessage(array_object); 594 writer.WriteMessage(array_object);
591 intptr_t buffer_len = writer.BytesWritten(); 595 intptr_t buffer_len = writer.BytesWritten();
592 596
593 // Read object back from the snapshot. 597 // Read object back from the snapshot.
594 SnapshotReader reader(buffer, buffer_len, Snapshot::kMessage, isolate, 598 MessageSnapshotReader reader(buffer,
595 zone.GetZone()); 599 buffer_len,
600 isolate,
601 zone.GetZone());
596 reader.ReadObject(); 602 reader.ReadObject();
597 free(buffer); 603 free(buffer);
598 } 604 }
599 timer.Stop(); 605 timer.Stop();
600 int64_t elapsed_time = timer.TotalElapsedTime(); 606 int64_t elapsed_time = timer.TotalElapsedTime();
601 benchmark->set_score(elapsed_time); 607 benchmark->set_score(elapsed_time);
602 } 608 }
603 609
604 } // namespace dart 610 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/bin/snapshot_in.cc ('k') | runtime/vm/dart.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698