Warning: session_start(): open(/var/lib/php/sessions/sess_nc2u3uk98ku50acogr63tl5lnt, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
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);
}