[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-apl] Very slow ")save" on large workspace
From: |
Christian Robert |
Subject: |
[Bug-apl] Very slow ")save" on large workspace |
Date: |
Thu, 27 Oct 2016 22:13:38 -0400 |
User-agent: |
Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 |
)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.
- [Bug-apl] Very slow ")save" on large workspace,
Christian Robert <=