Workspace Usage when Indexing?
3 posts
• Page 1 of 1
Workspace Usage when Indexing?
I greatly prefer using the indexing function to bracket-indexing, but have noticed a difference in workspace requirements.
Using some large vectors I started hitting WS FULL with ((⊂index)⌷vector)←newvalues.
However, with the same data vector[index]←newvalues executes without problems.
Anyone seen anything similar? In my state of childish innocence I'd assumed that the inner workings would be the same for either syntax.
Using some large vectors I started hitting WS FULL with ((⊂index)⌷vector)←newvalues.
However, with the same data vector[index]←newvalues executes without problems.
Anyone seen anything similar? In my state of childish innocence I'd assumed that the inner workings would be the same for either syntax.
Visit http://apl.dickbowman.com to read more from Dick Bowman
-
Dick Bowman - Posts: 235
- Joined: Thu Jun 18, 2009 4:55 pm
Re: Workspace Usage when Indexing?
Yes. Using this expression in which cf is an operator that compares the timings of its two function operands:
{z←?(2×⍵)⍴⍵ ⋄ x←?⍵⍴⍵ ⋄ {z[x]←x}cf{((⊂x)⌷z)←x}⍵}100
I gave it increasing powers of 10 until WS FULL that hit the right operand first.
The speed comparison had been consistently in favour of the left with a factor of between 2 and 3 times as fast.
{z←?(2×⍵)⍴⍵ ⋄ x←?⍵⍴⍵ ⋄ {z[x]←x}cf{((⊂x)⌷z)←x}⍵}100
I gave it increasing powers of 10 until WS FULL that hit the right operand first.
The speed comparison had been consistently in favour of the left with a factor of between 2 and 3 times as fast.
-
Phil Last - Posts: 624
- Joined: Thu Jun 18, 2009 6:29 pm
- Location: Wessex
Re: Workspace Usage when Indexing?
I think that what is happening here is that, in general, with a selective specification, such as:
The evaluation starts with a full index set for VAR (i.e. ⍳⍴VAR), which is modified right-to-left by successive functions. So, for example, we could have:
whereas
depends only on the number of items in x.
It could pay us to find some special cases, such as when there is only a single selection function, but we don't do so at the moment. I have "put it on the list", ref[5679].
- Code: Select all
(f g ... h VAR) ← ...
The evaluation starts with a full index set for VAR (i.e. ⍳⍴VAR), which is modified right-to-left by successive functions. So, for example, we could have:
- Code: Select all
vec←⎕a
(6↑,⌽⍉5 5⍴vec)←'.'
vec
.BCDE.GHIJ.LMNO.QRST..WXYZ
whereas
- Code: Select all
VAR[x]←...
depends only on the number of items in x.
It could pay us to find some special cases, such as when there is only a single selection function, but we don't do so at the moment. I have "put it on the list", ref[5679].
- JohnS|Dyalog
3 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group