Make classes visibly initialized in bigger batches.
Change the batch size from 16 to 48. This should make app
startup faster for apps that initialize a lot of classes.
Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing
Bug: 38383823
Change-Id: If6387dab27887b7380e30ee6e8b3376158ff04de
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index a2d07a5..b98f704 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -299,7 +299,13 @@
}
}
- static constexpr size_t kMaxClasses = 16;
+ // Making classes initialized in bigger batches helps with app startup for
+ // apps that initialize a lot of classes by running fewer checkpoints.
+ // (On the other hand, bigger batches make class initialization checks more
+ // likely to take a slow path but that is mitigated by making partially
+ // filled buffers visibly initialized if we take the slow path many times.
+ // See `Thread::kMakeVisiblyInitializedCounterTriggerCount`.)
+ static constexpr size_t kMaxClasses = 48;
ClassLinker* const class_linker_;
size_t num_classes_;