Post Reply 
HHC 2021 Programming Contests - Surprise !
10-04-2021, 08:00 AM
Post: #9
RE: HHC 2021 Programming Contests - Surprise !
(10-03-2021 11:51 PM)3298 Wrote:  Out of curiosity I fed the full range into the faster of them just now, and it takes tens of minutes at least; not sure if I'm going to let it finish. In theory it should do so eventually, because it works fine on smaller requests, and I'm not aware of any hard limits it could bump into.
In the end I went to sleep (it was already the middle of the night here in Europe), and relied on TEVAL and auto-OFF to take care of it. When waking up, the correct sum and a time of 7373.319_s were waiting for me. Yes, two whole hours and a little bit. I didn't think SysRPL would win by that much of a margin.
I blame LIST\-> putting object references into the list on the stack, which makes the garbage collection take forever each time it runs during the square-and-sum-up loop. Maybe a hybrid program using metas for sequence construction and \GSLIST afterwards would have been faster for such an extreme test, let's try ... uh-oh, it explodes on SQ with "Insufficient Memory" even though my real 50g has next nothing occupying memory on it (>220KB free). That means the compact SQ \GSLIST approach might not even qualify, because it fails to return correct results for extreme but valid inputs. (Granted, it could be a matter of needing just the few extra kilobytes which are occupied on my 50g.)
Let's try 0. SWAP 1. \<< SQ + \>> DOLIST after the SUB command instead: success after 60.7329_s. This makes it 108 bytes in size, checksum #A10Fh.

On the topic of speed, I suspect newRPL would demolish my results, both UserRPL and SysRPL. Does it still count as an RPL machine, though?

(10-04-2021 12:16 AM)John Keith Wrote:  taking about 9.7 seconds on an HP 50g for a = 500 and b = 1000.
[snip]
... and a bit faster (about 8.9 seconds for the same values as above).
For the sake of comparing apples to apples, my speed-optimized UserRPL solution takes 3.114_s (the size-optimized one takes 28.2468_s, but at less than 100 bytes, the score doesn't care about that anymore; the DOLIST one needs 3.7296_s), and the SysRPL version takes 1.1782_s.

And the speedy programs' time for the official test cases, now that we have them:
1 5 -> 27
UserRPL: .074_s (DOLIST edition: .0692_s), SysRPL: .0229_s
2 4 -> 17
UserRPL: .0398_s (DOLIST edition: .0607_s), SysRPL: .0209_s
5 5 -> 9
UserRPL: .0333_s (DOLIST edition: .0509_s), SysRPL: .0166_s
100 101 -> 882
UserRPL: .2469_s (DOLIST edition: .265_s), SysRPL: .0327_s
1000 1500 -> 4884182
UserRPL: 3.4551_s (DOLIST edition: 4.0587_s), SysRPL: 1.2148_s
2000 2300 -> 5724200 (my programs report 5724280 instead, is that a typo?)
UserRPL: 3.1559_s (DOLIST edition: 3.5319_s), SysRPL: .8707_s

For the last two test cases, the compact variants lose on score to the quick ones, and the one I edited to use DOLIST can't show its strength because the inputs aren't extreme enough.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: HHC 2021 Programming Contests - Surprise ! - 3298 - 10-04-2021 08:00 AM



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