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

10
LINES

< > BotCompany Repo | #1032636 // renderCollectionBytesPerEntry

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

Libraryless. Click here for Pure Java version (4725L/27K).

static <A> S renderCollectionBytesPerEntry(Cl<A> l) {
  O[] a = toObjectArray_nonConcurrent(l);
  long arraySize = unsafe_sizeOf(a);
  long payloadSize = guessObjectSize(a)-arraySize;
  
  long fullSize = guessObjectSize(l);
  
  ret "A " + className(l) + " with " + nElements(l) + " uses "
    + formatDoubleRatio(fullSize-payloadSize, l(a), 4) + " bytes per element (full size: " + n2(fullSize) + ", payload: " + n2(payloadSize) + ")";
}

Author comment

Began life as a copy of #1032635

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1032636
Snippet name: renderCollectionBytesPerEntry
Eternal ID of this version: #1032636/1
Text MD5: e927666bdc7af14110b91924f91ce0cf
Transpilation MD5: 20afd06029668364f904daa72c944e3b
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-09-29 22:49:44
Source code size: 448 bytes / 10 lines
Pitched / IR pitched: No / No
Views / Downloads: 146 / 193
Referenced in: [show references]