Libraryless. Click here for Pure Java version (1155L/8K/30K).
1 | !7 |
2 | |
3 | p {
|
4 | for (int strlen = 4; strlen <= 40; strlen++) {
|
5 | Iterator<S> it = allWordsOfAlphabet_fixedLength(lowerCaseAlphabet(), strlen); |
6 | O[] array = new O[100000]; |
7 | long mem1 = usedMemoryAfterGC(); |
8 | for i over array: {
|
9 | assertTrue("Alphabet", it.hasNext());
|
10 | array[i] = it.next(); |
11 | } |
12 | long mem2 = usedMemoryAfterGC(); |
13 | double objSize = (mem2-mem1)/(double) l(array); |
14 | int rounded = iround(objSize); |
15 | long f = guessStringSize(strlen); |
16 | print("String length=" + strlen + ". Approximate object size: " + objSize + " => " + rounded + " bytes. Formula: " + f);
|
17 | } |
18 | } |
download show line numbers debug dex old transpilations
Travelled to 16 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, wtqryiryparv
No comments. add comment
| Snippet ID: | #1009423 |
| Snippet name: | Measure size of string [OK] |
| Eternal ID of this version: | #1009423/16 |
| Text MD5: | 78d293b9d1748def59bcf3c7be3eaf3f |
| Transpilation MD5: | 378d2fef0d1532fb2d718ececfa17851 |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX source code |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2018-07-11 22:10:36 |
| Source code size: | 618 bytes / 18 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 793 / 1005 |
| Version history: | 15 change(s) |
| Referenced in: | [show references] |