Transpiled version (461L) is out of date.
1 | !7 |
2 | |
3 | static int n = 100000; |
4 | |
5 | p {
|
6 | for (int listSize = 90; listSize <= 100; listSize++) {
|
7 | O[] array = new O[n]; |
8 | long mem1 = usedMemoryAfterGC(); |
9 | for i over array: array[i] = rep(null, listSize); |
10 | long mem2 = usedMemoryAfterGC(); |
11 | double objSize = (mem2-mem1)/(double) l(array); |
12 | int rounded = iround(objSize); |
13 | long f = guessArrayListSize(listSize); |
14 | bool ok = rounded == f; |
15 | print((ok ? "OK " : "") + "ArrayList size=" + listSize + ". Approximate object size: " + objSize + " => " + rounded + " bytes. Formula: " + f); |
16 | } |
17 | } |
Began life as a copy of #1009433
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, wtqryiryparv
No comments. add comment
| Snippet ID: | #1009436 |
| Snippet name: | Measure size of ArrayList [OK] |
| Eternal ID of this version: | #1009436/7 |
| Text MD5: | 53c6e3936dd7b10c68add45ed29b0654 |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX source code |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2017-08-01 04:31:49 |
| Source code size: | 570 bytes / 17 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 647 / 884 |
| Version history: | 6 change(s) |
| Referenced in: | [show references] |