Libraryless. Click here for Pure Java version (1147L/8K/30K).
1 | !7 |
2 | |
3 | p { |
4 | for (int strlen = 4; strlen <= 40; strlen++) { |
5 | Iterator<S> it = allWordsOfAlphabet_fixedLength("\u13a0\u13a1\u13a2\u13a3\u13a4\u13a5\u13a6\u13a7\u13a8\u13a9\u13aa\u13ab\u13ac\u13ad\u13ae\u13af", 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 | } |
Began life as a copy of #1009423
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: | #1017087 |
Snippet name: | Measure size of non-Latin string [OK] |
Eternal ID of this version: | #1017087/1 |
Text MD5: | 92bc1bbe4d9ab824356f6389fde321d4 |
Transpilation MD5: | 59873ce242a3aa8f66f244b2b0dfa801 |
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:23:02 |
Source code size: | 697 bytes / 18 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 353 / 439 |
Referenced in: | [show references] |