bug-apl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-apl] Unique far too slow


From: Juergen Sauermann
Subject: Re: [Bug-apl] Unique far too slow
Date: Sat, 17 Sep 2016 14:43:29 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.4.0

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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]