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).

1  
static double exclusive_measureSizeOfObject(int instances default 100000, IF0<O> f) {
2  
  ret exclusive_measureSizeOfObject(instances, if0ToF0(f));
3  
}
4  
5  
static double exclusive_measureSizeOfObject(int instances, F0<O> f) {
6  
  O[] array = new O[instances];
7  
  long mem1 = usedMemoryAfterGC();
8  
  for i over array: {
9  
    array[i] = callF(f);
10  
  }
11  
  long mem2 = usedMemoryAfterGC();
12  
  ret (mem2-mem1)/(double) l(array);
13  
}

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: 338 / 390
Version history: 5 change(s)
Referenced in: [show references]