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

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

Issue 1012333002: Keep zone cached in SnapshotReader to allow removing ZoneHandle(Isolate*) interface. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 9 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/lib/string.cc ('k') | runtime/vm/code_generator.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 516 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 uint8_t* buffer; 527 uint8_t* buffer;
528 Timer timer(true, "Serialize Null"); 528 Timer timer(true, "Serialize Null");
529 timer.Start(); 529 timer.Start();
530 for (intptr_t i = 0; i < kLoopCount; i++) { 530 for (intptr_t i = 0; i < kLoopCount; i++) {
531 StackZone zone(isolate); 531 StackZone zone(isolate);
532 MessageWriter writer(&buffer, &message_allocator, true); 532 MessageWriter writer(&buffer, &message_allocator, true);
533 writer.WriteMessage(null_object); 533 writer.WriteMessage(null_object);
534 intptr_t buffer_len = writer.BytesWritten(); 534 intptr_t buffer_len = writer.BytesWritten();
535 535
536 // Read object back from the snapshot. 536 // Read object back from the snapshot.
537 SnapshotReader reader(buffer, buffer_len, Snapshot::kMessage, isolate); 537 SnapshotReader reader(buffer, buffer_len, Snapshot::kMessage, isolate,
538 zone.GetZone());
538 reader.ReadObject(); 539 reader.ReadObject();
539 } 540 }
540 timer.Stop(); 541 timer.Stop();
541 int64_t elapsed_time = timer.TotalElapsedTime(); 542 int64_t elapsed_time = timer.TotalElapsedTime();
542 benchmark->set_score(elapsed_time); 543 benchmark->set_score(elapsed_time);
543 } 544 }
544 545
545 546
546 BENCHMARK(SerializeSmi) { 547 BENCHMARK(SerializeSmi) {
547 const Integer& smi_object = Integer::Handle(Smi::New(42)); 548 const Integer& smi_object = Integer::Handle(Smi::New(42));
548 const intptr_t kLoopCount = 1000000; 549 const intptr_t kLoopCount = 1000000;
549 Isolate* isolate = Isolate::Current(); 550 Isolate* isolate = Isolate::Current();
550 uint8_t* buffer; 551 uint8_t* buffer;
551 Timer timer(true, "Serialize Smi"); 552 Timer timer(true, "Serialize Smi");
552 timer.Start(); 553 timer.Start();
553 for (intptr_t i = 0; i < kLoopCount; i++) { 554 for (intptr_t i = 0; i < kLoopCount; i++) {
554 StackZone zone(isolate); 555 StackZone zone(isolate);
555 MessageWriter writer(&buffer, &message_allocator, true); 556 MessageWriter writer(&buffer, &message_allocator, true);
556 writer.WriteMessage(smi_object); 557 writer.WriteMessage(smi_object);
557 intptr_t buffer_len = writer.BytesWritten(); 558 intptr_t buffer_len = writer.BytesWritten();
558 559
559 // Read object back from the snapshot. 560 // Read object back from the snapshot.
560 SnapshotReader reader(buffer, buffer_len, Snapshot::kMessage, isolate); 561 SnapshotReader reader(buffer, buffer_len, Snapshot::kMessage, isolate,
562 zone.GetZone());
561 reader.ReadObject(); 563 reader.ReadObject();
562 } 564 }
563 timer.Stop(); 565 timer.Stop();
564 int64_t elapsed_time = timer.TotalElapsedTime(); 566 int64_t elapsed_time = timer.TotalElapsedTime();
565 benchmark->set_score(elapsed_time); 567 benchmark->set_score(elapsed_time);
566 } 568 }
567 569
568 570
569 BENCHMARK(SimpleMessage) { 571 BENCHMARK(SimpleMessage) {
570 const Array& array_object = Array::Handle(Array::New(2)); 572 const Array& array_object = Array::Handle(Array::New(2));
571 array_object.SetAt(0, Integer::Handle(Smi::New(42))); 573 array_object.SetAt(0, Integer::Handle(Smi::New(42)));
572 array_object.SetAt(1, Object::Handle()); 574 array_object.SetAt(1, Object::Handle());
573 const intptr_t kLoopCount = 1000000; 575 const intptr_t kLoopCount = 1000000;
574 Isolate* isolate = Isolate::Current(); 576 Isolate* isolate = Isolate::Current();
575 uint8_t* buffer; 577 uint8_t* buffer;
576 Timer timer(true, "Simple Message"); 578 Timer timer(true, "Simple Message");
577 timer.Start(); 579 timer.Start();
578 for (intptr_t i = 0; i < kLoopCount; i++) { 580 for (intptr_t i = 0; i < kLoopCount; i++) {
579 StackZone zone(isolate); 581 StackZone zone(isolate);
580 MessageWriter writer(&buffer, &malloc_allocator, true); 582 MessageWriter writer(&buffer, &malloc_allocator, true);
581 writer.WriteMessage(array_object); 583 writer.WriteMessage(array_object);
582 intptr_t buffer_len = writer.BytesWritten(); 584 intptr_t buffer_len = writer.BytesWritten();
583 585
584 // Read object back from the snapshot. 586 // Read object back from the snapshot.
585 SnapshotReader reader(buffer, buffer_len, Snapshot::kMessage, isolate); 587 SnapshotReader reader(buffer, buffer_len, Snapshot::kMessage, isolate,
588 zone.GetZone());
586 reader.ReadObject(); 589 reader.ReadObject();
587 free(buffer); 590 free(buffer);
588 } 591 }
589 timer.Stop(); 592 timer.Stop();
590 int64_t elapsed_time = timer.TotalElapsedTime(); 593 int64_t elapsed_time = timer.TotalElapsedTime();
591 benchmark->set_score(elapsed_time); 594 benchmark->set_score(elapsed_time);
592 } 595 }
593 596
594 } // namespace dart 597 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/lib/string.cc ('k') | runtime/vm/code_generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698