scope bench_reflectiveCallWithInternedMethodName. static long #what; svoid bench_reflectiveCallWithInternedMethodName() { what = 0; class MyObj { void veryLongMethodNameToIllustrateThePoint() { ++what; } } S methodName = "veryLongMethodNameToIllustrateThePoint"; _MethodCache cache = callOpt_getCache(MyObj.class); S nameInCache = firstThat(keys(cache.cache), name -> eq(name, methodName)); print(nameInCache == methodName ? "Name in cache is interned! (GOOD)" : "Name in cache is NOT interned!! (so this is all pointless)"); embedded void benchCall(O o, S method) { benchFor10(-> call(o, method)); } print("string literal"); benchCall(new MyObj, methodName); print(what); print("constructed string"); S methodName2 = firstToLower("VeryLongMethodNameToIllustrateThePoint"); if (methodName2 != methodName && eq(methodName2, methodName)) print(" (yes they're different - but equal)"); else fail("what!?"); benchCall(new MyObj, methodName2); print(what); print("interned constructed string"); S methodName3 = methodName2.intern(); if (methodName3 == methodName) print(" (yes it's the same as the literal)"); else warn("This is not good - interned is not same as literal"); benchCall(new MyObj, methodName3); print(what); }