How can I read the size of a table (in bytes) in Q?
I开发者_如何学Go know that hcount
returns the size of a file in bytes, but I can't find something similar for tables (or in general any object...)
−22!x
is an optimised shortcut to count -8!x
q)(-22!trade)~count -8!trade
1b
q)\t:100 count -8!trade
3596
q)\t:100 -22!trade
839
this is serialized (wire) object size
play around with \w
this will give you object size in memory
q)a:til 10000
q)count -8!a
40014
q)\w
176464 67108864 67108864 0 0 2137387008j
q)b:til 10000
q)\w
242000 67108864 67108864 0 0 2137387008j
q)242000-176464
65536
q)\ts b,a
0 131200j
q)131248%2
65624f
q)
After some searching, it appears that count -8!tablename
does the trick.
精彩评论