The following program is parsing csv into in-memory table at about 22 MB/sec. I have repeated the benchmark a few times. The data is in the OS disk cache. The program is 1 core CPU-bound. My CPU is i5-3230M @ 2.60 GHz on a laptop. How can I make it faster? What have I missed in the tutorials? Thx.
http://code.kx.com/wiki/Cookbook/LoadingFromLargeFiles
http://code.kx.com/wiki/Cookbook/LoadingFromLargeFilesAndSplaying
/ csvParsingBenchmark.q
fieldNames: `tsStr`sym`tradePrice`cumTradeVol`bidFlag`bidPrice1`bidVol1`bidPrice2`bidVol2`bidPrice3`bidVol3`bidPrice4`bidVol4`bidPrice5`bidVol5`askFlag`askPrice1`askVol1`askPrice2`askVol2`askPrice3`askVol3`askPrice4`askVol4`askPrice5`askVol5;
formatString: "*SFJSFJFJFJFJFJSFJFJFJFJFJ";
csvFile: `$":/tmp/marketdata/20140130.csv";
a:0;
.Q.fsn[{flip fieldNames!(formatString;",") 0: x; show (string .z.P), " ", (string a+:1)}; csvFile; 100*1024*1024]
$ tail -5 20140130.csv
20140130_120000_030000,28964,0.032,4030000,B,0.029,100000,0.027,480000,0.026,480000,0.025,1780000,0.024,480000,A,0.036,480000,0.038,480000,0.039,480000,0.045,999999,999999.000,999999
20140130_120000_030000,28964,0.032,4030000,B,0.029,100000,0.027,480000,0.026,480000,0.025,1780000,0.024,480000,A,0.036,480000,0.037,480000,0.038,480000,0.039,480000,0.045,999999
20140130_120000_030000,28964,0.032,4030000,B,0.029,100000,0.027,480000,0.026,480000,0.025,1780000,0.024,480000,A,0.036,480000,0.037,480000,0.039,480000,0.045,999999,999999.000,999999
20140130_120000_030000,28964,0.032,4030000,B,0.029,100000,0.027,480000,0.026,480000,0.025,1780000,0.024,480000,A,0.036,480000,0.037,480000,0.045,999999,999999.000,999999,999999.000,999999
20140130_120000_030000,67387,999999.000,0,B,0.244,1000000,0.243,1000000,0.242,1000000,0.241,1000000,0.240,1000000,A,0.246,1000000,0.247,1000000,0.248,1000000,0.249,1000000,0.250,1000000