Commits
Tarun Sukhani authored 79615d5fc40
perf: cache Scala default-method probe in Binder.bind (PF-103) Binder.bind probes for Scala-style $default$N helper methods on every parameter bind via Class.getDeclaredMethod. In Java-only Play apps the lookup always misses, so each bind throws NoSuchMethodException — a JDK exception with a full stack walk and a StackTraceElement allocation. A 3-parameter action under load produces three throws per request. Pure control-flow overhead with no observable behavioural effect. Replace the per-call probe with a ConcurrentHashMap cache keyed by declaring-class-name + method-name + parameter-index. The first lookup resolves reflectively and stores either the resolved Method or a static sentinel for the negative case; every subsequent lookup is a single map read. The sentinel is a private no-op method on Binder reached via class-init-time reflection, so a cache hit allocates nothing. Behaviour preserved: Scala apps still resolve the real helper on the first probe and cache it; Java apps cache the sentinel and skip the throw on every subsequent call. The primitive-default fall-through is unchanged. No public API surface changes — the cache + sentinel are package-private only so tests can verify population. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>