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

24
LINES

< > BotCompany Repo | #1024095 // estimateWebBotSize [old version]

JavaX fragment (include)

sclass SizeEstimate {
  new Map<S, Long> shallowFieldSizes;
  new Set<S> complexFields;
  new Map<S, Long> complexFieldSizes;
}

static SizeEstimate estimateWebBotSize(O o) {
  new SizeEstimate se;
  Collection<S> fields = fields(o);
  for (S field : fields) {
    if (sizeCalculation_shouldIgnoreProgramField(field)) continue;
    O value = get(o, field);
    if (value == null) continue;
    Class type = value.getClass();
    if (isBoxedType(type) || isPrimitiveArray(value))
      continue with se.shallowFieldSizes.put(field, deepObjectSize(value));
    se.complexFields.add(field);
  }
  
  O[] array = asObjectArray(getFields(o, se.complexFields));
  new guessDeepObjectSize_recursive_Data data;
  data.seen.add(o);
  ret guessDeepObjectSize_recursive(data, array)-inMemorySizeOfArray(array);
}

Author comment

Began life as a copy of #1024089

download  show line numbers  debug dex  old transpilations   

Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

-
Snippet ID: #1024095
Snippet name: estimateWebBotSize [old version]
Eternal ID of this version: #1024095/1
Text MD5: 85d29ff50673ed49d4a9de31c84eb04e
Author: stefan
Category: javax / html
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-07-20 18:29:58
Source code size: 824 bytes / 24 lines
Pitched / IR pitched: No / No
Views / Downloads: 182 / 212
Referenced in: