Performance optimization opportunities in Analyzer
Opened this issue · 0 comments
lrytz commented
Identified by @retronym scala/scala#6075 (comment)
Type.getArgumentTypes(desc).length/Type.getReturnType(desc) == Type.VOID_TYPEcould be directly implemented without constructing aTypeisntance- The same can be done in the Scala compiler (https://github.com/scala/scala/blob/v2.12.3/src/compiler/scala/tools/nsc/backend/jvm/analysis/InstructionStackEffect.scala#L63-L64)
In Type.java, a number of String to char[] conversions are performed to call into getType. If this method was duplicated to operatoe on String directly, those conversions could be avoided.
public static Type getReturnType(final String methodDescriptor) {
char[] buf = methodDescriptor.toCharArray();
return getType(buf, methodDescriptor.indexOf(')') + 1);
}
Could use lastIndexOf to search from the end of the descriptor.