Knock 0.5s off the Calculator startup time.
Down to 2.5s on mysid. We now only mess around with std::strings when we need
to synthesize a descriptor. If we can just hand out a const char* straight from
the dex file -- which most of the time we can -- we now do.
Change-Id: Iddec7062d8bd578bd25f671eb4d597e9ed064d65
diff --git a/src/primitive.h b/src/primitive.h
index 402a2b5..ae2e487 100644
--- a/src/primitive.h
+++ b/src/primitive.h
@@ -88,29 +88,29 @@
return ComponentSize(type) <= 4 ? 4 : 8;
}
- static char DescriptorChar(Type type) {
+ static const char* Descriptor(Type type) {
switch (type) {
case kPrimBoolean:
- return 'Z';
+ return "Z";
case kPrimByte:
- return 'B';
+ return "B";
case kPrimChar:
- return 'C';
+ return "C";
case kPrimShort:
- return 'S';
+ return "S";
case kPrimInt:
- return 'I';
+ return "I";
case kPrimFloat:
- return 'F';
+ return "F";
case kPrimLong:
- return 'J';
+ return "J";
case kPrimDouble:
- return 'D';
+ return "D";
case kPrimVoid:
- return 'V';
+ return "V";
default:
LOG(FATAL) << "Primitive char conversion on invalid type " << static_cast<int>(type);
- return 0;
+ return NULL;
}
}