bug-apl
[Top][All Lists]

## Re: [Bug-apl] Very slow ")save" on large workspace

 From: Christian Robert Subject: Re: [Bug-apl] Very slow ")save" on large workspace Date: Sat, 29 Oct 2016 15:14:23 -0400 User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0

```Impressive !

On my tablet it went from over 2 hours to 16 seconds now !

thanks,

Xtian.

On 2016-10-29 13:54, Juergen Sauermann wrote:
```
```Hi Xtian,

thanks, fixed in *SVN 801*.

/// Jürgen

On 10/28/2016 04:13 AM, Christian Robert wrote:
```
```      )clear
∇z←permute s
→((⍴,s)≤1)/ident
→((⍴s)>2)/recurse
z←s⍪1 2⍴⌽s ⋄ →0
ident: z←s ⋄ →0
recurse: z←(((⍴,z)÷⍴s),⍴s)⍴,z←{⍵,permute s~⍵}⍤0 s
∇

⍝ Now do this

v ← {⊂ 3 3 ⍴ ⍵}⍤1 permute ⍳9

⍴v
362880

⍝ "v" is a vector of all possibles permutations of 9 numbers arranged in
a 3x3 matrix.

⍝ first 10 of the 362880 ones ...

8⎕cr ¨ 10 ↑ v
┌→────┐  ┌→────┐  ┌→────┐  ┌→────┐  ┌→────┐  ┌→────┐  ┌→────┐  ┌→────┐
┌→────┐  ┌→────┐
↓1 2 3│  ↓1 2 3│  ↓1 2 3│  ↓1 2 3│  ↓1 2 3│  ↓1 2 3│  ↓1 2 3│  ↓1 2 3│  ↓1 2
3│  ↓1 2 3│
│4 5 6│  │4 5 6│  │4 5 6│  │4 5 6│  │4 5 6│  │4 5 6│  │4 5 7│  │4 5 7│  │4 5
7│  │4 5 7│
│7 8 9│  │7 9 8│  │8 7 9│  │8 9 7│  │9 7 8│  │9 8 7│  │6 8 9│  │6 9 8│  │8 6
9│  │8 9 6│
└─────┘  └─────┘  └─────┘  └─────┘  └─────┘  └─────┘  └─────┘  └─────┘
└─────┘  └─────┘

⍝ Now wallclock time how long it take to do a )save ...  (on my fast
machine, took 139 seconds)

⍝ Remark that the )load will take something like only 1/100th or 2/100th
of the )save time.

So, ")save" is far too slow on workspace with a large number of cells ...

Hoping you can improve it (as you did for Unique few weeks ago).

Xtian.

ps: ")dump" is very fast (~2 seconds) but reloading that .apl file take near
infinite time.
```
```
```