C:\q>qKDB+ 2.4 2008.03.13 Copyright (C) 1993-2008 Kx Systemsw32/ 2()core 2046MB sa jax 172.16.6.139 EXPIRE 2009.01.01 sa@nsl.com#42171q)\t 8#'1000 10000#0156q)\t 8#'1000 10000#062q)the best way to benchmark is to take averages over several runs:C:\q>qKDB+ 2.4 2008.03.13 Copyright (C) 1993-2008 Kx Systemsw32/ 2()core 2046MB sa jax 172.16.6.139 EXPIRE 2009.01.01 sa@nsl.com#42171q)\t do[10;8#'1000 10000#0]640q)On Apr 6, 9:38�am, Joel Reymont wrote:> Suppose we had a list of 10000000> phone numbers and wanted to take> just the first 8 digits of each.>> We could create the list like this:>> q)l:10000000 10#99?"0123456789">> Here, 99?... creates a vector of 99> random characters from the set [0-9]> and 10#... takes 10 characters from> each generated "phone number".>> 10000000 ... repeats it that many times.>> A simple 8#l will just gives us the first> 8 elements of the list which is not what> we want.>> q)f1:{x@\:til 8}> q)f2:{8#/:x}> q)f3:{8#'x}>> The above 3 solutions will give us the> first 8 digits of every phone number> in the list.>> Which solution is the fastest, though?>> The list is very very long specifically> to make benchmarking easier.>> q)\t f1 l> 906>> \t here gives us execution time for f1> in milliseconds. We proceed to time f2> and f3.>> q)\t f2 l> 738> q)\t f3 l> 738>> Looks like f1 is much slower but is it?>> Lets run the benchmark several times...>> q)\t f1 l> 624> q)\t f2 l> 735>> � � � � -joel>> --> wagerlabs.com