Write xixSR ,
an adaptation of xiySR ,
to exploit the case where the left and right arguments are the same.
Run some benchmarks comparing xixSR x
and x xiySR y
where y←0+x .
z←xixSR x;⎕io;max;min;n;t
⍝ small-range version of x⍳x
⎕io←0
n←≢x
min←⌊/x
max←⌈/x
t←(1+max-min)⍴n ⍝ table of indices
t[⌽x-min]←⌽⍳n ⍝ populate table
z←t[x-min] ⍝ read index for each x
_____________________
x←1e7+?1e5⍴2e4
y←0+x
cmpx 'xixSR x' 'x xiySR y'
xixSR x → 1.09e¯3 | 0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
x xiySR y → 1.53e¯3 | +40% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
cmpx 'x⍳x' 'x⍳y'
x⍳x → 2.66e¯3 | 0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
x⍳y → 2.66e¯3 | -1% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕