« first day (1050 days earlier)      last day (1612 days later) » 

12:32 AM
Is there a way to exploit that the depths of 1 and and 1⍬ are 0 and 1 and ¯2 to shorten this?
2
A: I shift the source code, you shift the input!

AdámAPL (Dyalog Unicode), 15 11 bytesSBCS -4 thanks to inspiration from Luis Mendo's solution. Full program, prompting for input via stdin. 1⊢⍞⌽⍨¯2+≢1⍬ Try it online! 1⍬ the list [1,[]] ≢ tally the elements in that; 2 ¯2+ add negative two to that; 0 …⌽⍨ cyclically rotate the following by...

 
12:47 AM
@Adám This is around 20x faster than this. Is it solely because the former uses boolean array?
 
@Bubbler That, and iirc, modified assignments can be slow too.
 
Oh.
 
@Bubbler You can use ]profile to dig into what exactly consumes time.
 
@Adám Nice. Just tried it, and looks like (0⌈-)←1 is the real problem
Other assignments just take 2~3x more time.
 
@Bubbler I think that may be because it is a non-primitive function, which are slow in modified assignments.
 
1:10 AM
@Adám I could optimize it to 2x difference:
      cmpx 'P6G2 r' 'AoC2015.P6S r'
  P6G2 r        → 3.2E¯1 |   0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
* AoC2015.P6S r → 1.7E¯1 | -49% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
 
@Bubbler Uh, the results differ. (*)
 
@Adám It's the comparison between (optimized of the second link) vs (first link). The two are different tasks.
 
Oh.
 
Comparison with unoptimized version of same task:
      cmpx 'P6G2 r' 'AoC2015.P6G r'
  P6G2 r        → 3.2E¯1 |     0% ⎕⎕⎕
  AoC2015.P6G r → 3.7E0  | +1051% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
 
1:35 AM
@Bubbler ⍬⊢⍞⌽⍨⌈⌿↑¯1⍬
 

« first day (1050 days earlier)      last day (1612 days later) »