Hi Xtian,
thanks, fixed in SVN 796.
/// Jürgen
On 09/17/2016 05:12 AM, Christian
Robert wrote:
time "z ← downcase ¨ words readfile 'big.txt'"
7.859168565
time "s ← sortvs z"
4.423386895
⍝ well, read took 8 seconds (over a million words)
⍝ sorting the result took 5 seconds
time "U ← ∪ z"
101.1162267
⍝ why does the "∪" operator took so long ? eg: 101 seconds.
pretty sure this can be improved by a factor 2 to 5 times shorter.
my definitions:
downcase←{ ⎕UCS (32×(⍵≥65)∧⍵≤90)+⍵←⎕UCS ⍵}
readfile←{⎕fio[26] ⍵}
sortvs←{⍵[⎕av⍋⊃⍵]}
words←{(⍵ ∊ ,⎕ucs (65 97)∘.+⎕io-⍨⍳26) ⊂ ⍵}
big.txt is the one used in several reports last 2 weeks.
Xtian.
|