Skip to content

Instantly share code, notes, and snippets.

@interregna
Last active May 17, 2022 22:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save interregna/ad3ea2a33412c2daa4048020ecc007d1 to your computer and use it in GitHub Desktop.
Save interregna/ad3ea2a33412c2daa4048020ecc007d1 to your computer and use it in GitHub Desktop.
comparison of boxed and unboxed memory usage in J
gen =. {{
nobox =: (40 + ? y # 30) { a.
box =: <"0 (40 + ? y # 30) { a.
''
}}
relative_size =. {{
gen y
%/ 7!:5 'box';'nobox'
}}"0
load'plot'
plot_plot_ relative_size 100 * >: i.1000
@interregna
Copy link
Author

x-axis: count of characters / 100
y-axis: size in bytes of boxed vs unboxed

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment