-
How does nested columns/lists fragment memory?
Hi community:
I have a function executed every 5minutes in my application. In the function, I create some nested data structures and update them to a global table with nested columns. Note that each element in the nested column is not a uniform typed list, instead it may be a list of (timestamp; integer).
I found the function will cost more and more time to execute, and running .Q.gc is very slow too. The document of .Q.gc says nested column may cause memory fragment, I am not sure if it is the main reason that slows down the function.
Also, I did some simple test, and found .Q.gc take significant longer time on nested columns:
q)n:30000000;uids:5000?0Ng;tids:1000?0Ng q)trades: ([] uid:n?uids;tid:n?tids;sym:n?`1;qty:n?100f; price:n?1000f) q)\ts select by uid, tid from trades 11557 1610744224 q)\ts .Q.gc[] 134 512 q)\ts select qty, price by uid, tid from trades 21696 1947243520 q)\ts .Q.gc[] 5585 512
Can someone give me more instructions on this issue, especially on the memory allocation and recycle mechanism? Thanks a lot!
Log in to reply.