KDB uses reference counting, all vectors are passed by reference.
Tables are just collections of vectors and are also passed by reference.
For related info see:
http://code.kx.com/wiki/DotQ/DotQDotgc
http://code.kx.com/wiki/DotQ/DotQDotw
-Ryan Hamilton
From : “Sam” <jain.samit@gmail.com>
Sent : 10 October 2012 06:43
To : personal-kdbplus@googlegroups.com
Subject : [personal kdb+] table values vs references
Hi,
What is the best way to pass tables around in functions? I’ve large tables and I am writing functions to handle operations such as saving them. If I pass the table as it is by value, then it will create a copy of table at each assignment of a function call. This could be really expensive for large tables. However, if I pass the reference around (`tab), then certain operations such as .Q.en, .Q.par, select ,update, etc don’t work as they expect table value not reference.
So what is the ideal approach to handle tables?
thanks for your input.
–
Submitted via Google Groups