Reviewers: jochen (slow),

Message:
On 2015/01/23 08:20:19, jochen (slow) wrote:
the actual change is that you start with a initial old gen at the max size
(instead of 1/2 max size), and you only start recording the survival rate
after
one gc, right?

The actual change is that I am using now the promotion ratio, which is less
aggressive.

Description:
Use more conservative average promotion ratio for initial heap size.

BUG=

Please review this at https://codereview.chromium.org/849693004/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+27, -27 lines):
  M src/heap/gc-tracer.h
  M src/heap/gc-tracer.cc
  M src/heap/heap.cc


Index: src/heap/gc-tracer.cc
diff --git a/src/heap/gc-tracer.cc b/src/heap/gc-tracer.cc
index a35872dc47e1380311f19d1415a22292505169db..d46ed239c99ce5e9cc3f56d253be10f0fb157ffe 100644
--- a/src/heap/gc-tracer.cc
+++ b/src/heap/gc-tracer.cc
@@ -31,8 +31,8 @@ GCTracer::ContextDisposalEvent::ContextDisposalEvent(double time) {
 }


-GCTracer::SurvivalEvent::SurvivalEvent(double survival_rate) {
-  survival_rate_ = survival_rate;
+GCTracer::PromotionEvent::PromotionEvent(double promotion_ratio) {
+  promotion_ratio_ = promotion_ratio;
 }


@@ -257,8 +257,8 @@ void GCTracer::AddContextDisposalTime(double time) {
 }


-void GCTracer::AddSurvivalRate(double survival_rate) {
-  survival_events_.push_front(SurvivalEvent(survival_rate));
+void GCTracer::AddPromotionRatio(double promotion_ratio) {
+  promotion_events_.push_front(PromotionEvent(promotion_ratio));
 }


@@ -372,9 +372,9 @@ void GCTracer::PrintNVP() const {
   PrintF("nodes_copied_in_new=%d ", heap_->nodes_copied_in_new_space_);
   PrintF("nodes_promoted=%d ", heap_->nodes_promoted_);
   PrintF("promotion_ratio=%.1f%% ", heap_->promotion_ratio_);
+  PrintF("average_promotion_ratio=%.1f%% ", AveragePromotionRatio());
   PrintF("promotion_rate=%.1f%% ", heap_->promotion_rate_);
   PrintF("semi_space_copy_rate=%.1f%% ", heap_->semi_space_copied_rate_);
-  PrintF("average_survival_rate%.1f%% ", AverageSurvivalRate());
   PrintF("new_space_allocation_throughput=%" V8_PTR_PREFIX "d ",
          NewSpaceAllocationThroughputInBytesPerMillisecond());
PrintF("context_disposal_rate=%.1f ", ContextDisposalRateInMilliseconds()); @@ -570,25 +570,25 @@ double GCTracer::ContextDisposalRateInMilliseconds() const {
 }


-double GCTracer::AverageSurvivalRate() const {
-  if (survival_events_.size() == 0) return 0.0;
+double GCTracer::AveragePromotionRatio() const {
+  if (promotion_events_.size() == 0) return 0.0;

   double sum_of_rates = 0.0;
-  SurvivalEventBuffer::const_iterator iter = survival_events_.begin();
-  while (iter != survival_events_.end()) {
-    sum_of_rates += iter->survival_rate_;
+  PromotionEventBuffer::const_iterator iter = promotion_events_.begin();
+  while (iter != promotion_events_.end()) {
+    sum_of_rates += iter->promotion_ratio_;
     ++iter;
   }

-  return sum_of_rates / static_cast<double>(survival_events_.size());
+  return sum_of_rates / static_cast<double>(promotion_events_.size());
 }


 bool GCTracer::SurvivalEventsRecorded() const {
-  return survival_events_.size() > 0;
+  return promotion_events_.size() > 0;
 }


-void GCTracer::ResetSurvivalEvents() { survival_events_.reset(); }
+void GCTracer::ResetSurvivalEvents() { promotion_events_.reset(); }
 }
 }  // namespace v8::internal
Index: src/heap/gc-tracer.h
diff --git a/src/heap/gc-tracer.h b/src/heap/gc-tracer.h
index 528eb52c6455f073f8ed4139278ac4f2ef7462a1..07c175935d4fa27a2d325d61cf57e053894e7657 100644
--- a/src/heap/gc-tracer.h
+++ b/src/heap/gc-tracer.h
@@ -164,14 +164,14 @@ class GCTracer {
   };


-  class SurvivalEvent {
+  class PromotionEvent {
    public:
     // Default constructor leaves the event uninitialized.
-    SurvivalEvent() {}
+    PromotionEvent() {}

-    explicit SurvivalEvent(double survival_rate);
+    explicit PromotionEvent(double promotion_ratio);

-    double survival_rate_;
+    double promotion_ratio_;
   };


@@ -283,7 +283,7 @@ class GCTracer {
   typedef RingBuffer<ContextDisposalEvent, kRingBufferMaxSize>
       ContextDisposalEventBuffer;

- typedef RingBuffer<SurvivalEvent, kRingBufferMaxSize> SurvivalEventBuffer; + typedef RingBuffer<PromotionEvent, kRingBufferMaxSize> PromotionEventBuffer;

   explicit GCTracer(Heap* heap);

@@ -299,7 +299,7 @@ class GCTracer {

   void AddContextDisposalTime(double time);

-  void AddSurvivalRate(double survival_rate);
+  void AddPromotionRatio(double promotion_ratio);

   // Log an incremental marking step.
   void AddIncrementalMarkingStep(double duration, intptr_t bytes);
@@ -387,10 +387,10 @@ class GCTracer {
   // Returns 0 if no events have been recorded.
   double ContextDisposalRateInMilliseconds() const;

-  // Computes the average survival rate based on the last recorded survival
+ // Computes the average promotion ratio based on the last recorded promotion
   // events.
   // Returns 0 if no events have been recorded.
-  double AverageSurvivalRate() const;
+  double AveragePromotionRatio() const;

   // Returns true if at least one survival event was recorded.
   bool SurvivalEventsRecorded() const;
@@ -451,8 +451,8 @@ class GCTracer {
   // RingBuffer for context disposal events.
   ContextDisposalEventBuffer context_disposal_events_;

-  // RingBuffer for survival events.
-  SurvivalEventBuffer survival_events_;
+  // RingBuffer for promotion events.
+  PromotionEventBuffer promotion_events_;

// Cumulative number of incremental marking steps since creation of tracer.
   int cumulative_incremental_marking_steps_;
Index: src/heap/heap.cc
diff --git a/src/heap/heap.cc b/src/heap/heap.cc
index 641bae04eddff2de9ae2cc61415e3574348e6f1d..d4550949035c07e573287a67ce0596a885c5d064 100644
--- a/src/heap/heap.cc
+++ b/src/heap/heap.cc
@@ -67,7 +67,7 @@ Heap::Heap()
       initial_semispace_size_(Page::kPageSize),
       target_semispace_size_(Page::kPageSize),
       max_old_generation_size_(700ul * (kPointerSize / 4) * MB),
-      initial_old_generation_size_(max_old_generation_size_ / 2),
+      initial_old_generation_size_(max_old_generation_size_),
       old_generation_size_configured_(false),
       max_executable_size_(256ul * (kPointerSize / 4) * MB),
       // Variables set based on semispace_size_ and old_generation_size_ in
@@ -1048,6 +1048,8 @@ void Heap::UpdateSurvivalStatistics(int start_new_space_size) {
   promotion_ratio_ = (static_cast<double>(promoted_objects_size_) /
                       static_cast<double>(start_new_space_size) * 100);

+  if (gc_count_ > 1) tracer()->AddPromotionRatio(promotion_ratio_);
+
   if (previous_semi_space_copied_object_size_ > 0) {
     promotion_rate_ =
         (static_cast<double>(promoted_objects_size_) /
@@ -1061,8 +1063,6 @@ void Heap::UpdateSurvivalStatistics(int start_new_space_size) {
        static_cast<double>(start_new_space_size) * 100);

   double survival_rate = promotion_ratio_ + semi_space_copied_rate_;
-  tracer()->AddSurvivalRate(survival_rate);
-
   if (survival_rate > kYoungSurvivalRateHighThreshold) {
     high_survival_rate_period_length_++;
   } else {
@@ -2372,7 +2372,7 @@ void Heap::ConfigureInitialOldGenerationSize() {
         Max(kMinimumOldGenerationAllocationLimit,
             static_cast<intptr_t>(
                 static_cast<double>(initial_old_generation_size_) *
-                (tracer()->AverageSurvivalRate() / 100)));
+                (tracer()->AveragePromotionRatio() / 100)));
   }
 }



--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to