Post Reply 
RPL mini-challenge: Create an anti-Identity Matrix
05-13-2018, 09:55 PM (This post was last modified: 05-14-2018 01:54 AM by Claudio L..)
Post: #30
RE: RPL mini-challenge: Create an anti-Identity Matrix
I did some timings with newRPL on real 50g hardware. All times are for 1000 executions with argument of 30:

Code:

«
  IDN NEG DUP 1 CON + 
»
Total time: 12.411 seconds
Bytes: 32

Code:

«
  1 - → 
    N « 0 N FOR 'K' 1 N NDUPN 1 + K - 0 SWAP ROLLD 
    NEXT
    N 1 + DUP 2 →LIST →ARRY 
  »
»
Total time: 2.336 sec
Bytes: 132

Code:

«
  IDN AXL NOT AXL 
»
Total time: 96.751 sec
Bytes: 24

Code:

«
  → 
    N « 1 N FOR 'I' 1 N FOR 'J' I J ≠ 
      NEXT
    NEXT
    N N 2 →LIST →ARRY 
  »
»
Total time: 11.969 sec
Bytes: 112

And finally, I think the fastest implementation is Pier idea with 3298 improvements:
Code:

«
  2 OVER START
    0 1 ROT NDUPN 
  NEXT
  0 SWAP DUP 2 →LIST →ARRY 
»
Total time: 1.946 sec
Bytes: 64

Clearly, the advantage is in the element-by-element approach (EDIT: versus the full matrix ones, and "packed" elements using NDUPN is the winner approach).

EDIT: Added total bytes of each version in newRPL (for completeness only).
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: RPL mini-challenge: Create an anti-Identity Matrix - Claudio L. - 05-13-2018 09:55 PM



User(s) browsing this thread: 10 Guest(s)