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

13
LINES

< > BotCompany Repo | #1017098 // exclusive_measureSizeOfObject - exclusive = run exclusively on this VM

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (3976L/23K).

static double exclusive_measureSizeOfObject(int instances default 100000, IF0<O> f) {
  ret exclusive_measureSizeOfObject(instances, if0ToF0(f));
}

static double exclusive_measureSizeOfObject(int instances, F0<O> f) {
  O[] array = new O[instances];
  long mem1 = usedMemoryAfterGC();
  for i over array: {
    array[i] = callF(f);
  }
  long mem2 = usedMemoryAfterGC();
  ret (mem2-mem1)/(double) l(array);
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1017098
Snippet name: exclusive_measureSizeOfObject - exclusive = run exclusively on this VM
Eternal ID of this version: #1017098/6
Text MD5: 1aefb24098502af4f1b1cca66e976090
Transpilation MD5: a6e4e6a0caf333465e81fa1cb3cc4eef
Author: stefan
Category: javax / introspection
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-09-29 21:12:01
Source code size: 422 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 330 / 379
Version history: 5 change(s)
Referenced in: [show references]