Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

25
LINES

< > BotCompany Repo | #1007766 // callFOpt_cached - optimized version of callFOpt [untested]

JavaX fragment (include)

please include function callF.

static O callFOpt_cached(O f, O... args) ctex {
  if (f == null) null;
  if (f instanceof Runnable) { ((Runnable) f).run(); null; }
  if (f instanceof S) ret callOptMC((S) f, args);
  
  Class c = f.getClass();
  ArrayList<Method> methods;
  synchronized(callF_cache) {
    methods = callF_cache.get(c);
    if (methods == null)
      methods = callF_makeCache(c);
  }
  
  int n = l(methods);
  if (n == 0) null;
  if (n == 1) ret methods.get(0).invoke(f, args);
  for i to n: {
    Method m = methods.get(i);
    if (call_checkArgs(m, args, false))
      ret m.invoke(f, args);
  }
  null;
}

Author comment

Began life as a copy of #1007686

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

-
Snippet ID: #1007766
Snippet name: callFOpt_cached - optimized version of callFOpt [untested]
Eternal ID of this version: #1007766/1
Text MD5: 95693543d4482a46722830e1976daa92
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-04-05 11:25:10
Source code size: 649 bytes / 25 lines
Pitched / IR pitched: No / No
Views / Downloads: 455 / 467
Referenced in: