Reduce interpret-only compile time.
Before:
39.04user 5.18system 0:29.24elapsed 151%CPU (0avgtext+0avgdata 164176maxresident)k
38.87user 5.16system 0:29.14elapsed 151%CPU (0avgtext+0avgdata 164144maxresident)k
After:
36.26user 3.25system 0:27.00elapsed 146%CPU (0avgtext+0avgdata 162592maxresident)k
36.25user 3.28system 0:26.28elapsed 150%CPU (0avgtext+0avgdata 162688maxresident)k
Disabled implicit stack protection for the compiler, this reduces page faults.
Added support for not timing every method compilation and verification. NanoTime is
slow and adds ~2 seconds of real time. This is currently enabled since people want
to know which methods are slow to compile.
Bug: 16853450
Change-Id: I349ffb3f36db8c437137387aa6914dc17d743f09
diff --git a/runtime/verifier/method_verifier.cc b/runtime/verifier/method_verifier.cc
index 6f9680f..ef6b343 100644
--- a/runtime/verifier/method_verifier.cc
+++ b/runtime/verifier/method_verifier.cc
@@ -47,6 +47,7 @@
namespace art {
namespace verifier {
+static constexpr bool kTimeVerifyMethod = !kIsDebugBuild;
static constexpr bool gDebugVerify = false;
// TODO: Add a constant to method_verifier to turn on verbose logging?
@@ -252,7 +253,7 @@
bool allow_soft_failures,
bool need_precise_constants) {
MethodVerifier::FailureKind result = kNoFailure;
- uint64_t start_ns = NanoTime();
+ uint64_t start_ns = kTimeVerifyMethod ? NanoTime() : 0;
MethodVerifier verifier(dex_file, dex_cache, class_loader, class_def, code_item,
method_idx, method, method_access_flags, true, allow_soft_failures,
@@ -280,10 +281,12 @@
}
result = kHardFailure;
}
- uint64_t duration_ns = NanoTime() - start_ns;
- if (duration_ns > MsToNs(100) && !kIsDebugBuild) {
- LOG(WARNING) << "Verification of " << PrettyMethod(method_idx, *dex_file)
- << " took " << PrettyDuration(duration_ns);
+ if (kTimeVerifyMethod) {
+ uint64_t duration_ns = NanoTime() - start_ns;
+ if (duration_ns > MsToNs(100)) {
+ LOG(WARNING) << "Verification of " << PrettyMethod(method_idx, *dex_file)
+ << " took " << PrettyDuration(duration_ns);
+ }
}
return result;
}