Optimized Table Sort

Question: The built-in table sort function 'xasc' can sort tables in memory or on disk. It's commonly used during end-of-day operations to sort tables on disk after write down. Define a function 'xasc2' that is similar to 'xasc', but leverages multithreading when sorting on disk. You can disregard keyed tables as inputs.

More Information:

https://code.kx.com/q/ref/asc/#xasc

Example

                                
                                q).z.zd
17 2 6
q)count get `:trade
41303818
q)count cols `:trade
15
q)\s
12i
q)\t `sym`time xasc `:trade
145303
q)\t `sym`time xasc2 `:trade / 64% faster
51506
                                
                            

Solution

Tags:
multithreading optimizations tables
Searchable Tags
algorithms api architecture asynchronous c csv data structures dictionaries disk feedhandler finance functions ingestion ipc iterators machine learning math multithreading optimizations realtime shared library sql statistics streaming strings tables temporal utility websockets