Project

General

Profile

Feature #7348

mutable proxy implementation

Added by Eric Faulhaber 12 months ago. Updated 12 months ago.

Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
Due date:
% Done:

0%

billable:
No
vendor_id:
GCD

Related issues

Related to Base Language - Feature #6819: refactor FWD proxy implementation to use ReflectASM instead of Java Method reflection New

History

#1 Updated by Eric Faulhaber 12 months ago

For certain use cases (currently only for DMO proxies), we currently proxy an existing DMO proxy to redirect method invocations from the original proxy, to its invocation handler, then to another proxy and its invocation handler.

Constantin, do you have an idea how much overhead the TemporaryBuffer proxy of a proxy solution costs, compared to just having one level of proxy? I've been thinking that instead of having a two-layer proxy implementation, we make the DMO proxy mutable. That is, the invocation handler can be swapped out, or pushed onto a stack, or something...requiring only one level of delegation/redirection, instead of two.

I don't have the details figured out, and I'm not even sure how to describe it properly yet, but it seems like it has got to be less expensive going through only one invocation handler, rather than two, for every proxied method invocation. The question is one of priority: is this enough of a hot spot in the large applications we have been profiling to warrant immediate attention? Is it used heavily enough to matter for performance?

#2 Updated by Eric Faulhaber 12 months ago

  • Related to Feature #6819: refactor FWD proxy implementation to use ReflectASM instead of Java Method reflection added

#3 Updated by Constantin Asofiei 12 months ago

I've looked at the profiling data and the count is this:
  • ReferenceProxy.invoke - 600k via 44k instances and 12k 'bind' calls, ~35s total time
  • ArgumentBuffer.invoke - 1000 times via 100 instances
  • Handler.invoke - 6.7m via 60k instances, ~47s total time

For ReferenceProxy.invoke, there are 2 nested Utils.invoke calls. From these, the .buffer() call is ~50% of the calls, but the time spent is very low. But, from a total of ~35s in the profiler for ReferenceProxy.invoke, only ~50% is spent in the second Handler.invoke call.

From all Handler.invoke time, ~50% is spent in RecordBuffer.validateMaybeFlush, which is being called ~50k times.

From a cost/benefit analysis, I don't think mutable proxies will help much at this time.

Also available in: Atom PDF