Help / Release / J 5.04 / ({.,#)/. Improved

From J Wiki
Jump to navigation Jump to search


>> << Pri JfC LJ Phr Dic Voc !: Rel NuVoc wd Help Release



({.,#)/. Improved

initial writing: 2005-01-20
last updated: 2005-01-20


The verb x ({.,#)/. y produces a 2-column table of elements and frequency of occurrences. This verb and the verb x (#,{.)/.y have been made faster and leaner. The following benchmarks demonstrate the improvement.

ts=: 6!:2 , 7!:2@]  NB. time and space
ts '({.,#)/.~ x' 
x   J 5.04 J 5.03 Ratio
1e6 ?@$ 2  0.0003974  1.6000000e3 0.0405565  1.5730432e7  102.05  9831.52
1e6 ?@$ 1e4  0.0089623  1.9782400e5 0.1310025  1.8705344e7  14.62 94.56
1e6 ?@$ 1e5  0.0234292  1.5740800e6 0.3067714  2.6209600e7  13.09 16.65
1e6 ?@$ 1e6  0.1065352  1.2584128e7 0.8107853  7.3483584e7  7.61 5.84
0.01 * 1e6 ?@$ 1e5 0.4857553  1.8875584e7 0.7405234  3.1452736e7  1.52 1.67




>> << Pri JfC LJ Phr Dic Voc !: Rel NuVoc wd Help Release