scala/scala-asm-legacy

Performance optimization opportunities in Analyzer

Opened this issue · 0 comments

lrytz commented

Identified by @retronym scala/scala#6075 (comment)


https://github.com/scala/scala-asm/blob/v5.1.0-scala-2/src/main/java/scala/tools/asm/tree/analysis/Frame.java#L623-L632


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.