LOADING: An error occurred. Update Chrome, try Firefox, or visit this post for more details.

⚠️Reddit changed how removals work, which breaks Reveddit's website. Install the extension to track removed content:Add to chromeAdd to firefoxWhat changed?
✖︎
about reveddit
⚙F.A.Q.add-ons
r/
status
copy sharelink
[+] show filters
20
SOLUTION MEGATHREAD-❄️- 2024 Day 22 Solutions -❄️-(self.adventofcode)
submitted 1 year, 1 month ago* (edited 12 minutes after) by daggerdragon to /r/adventofcode (134.8k)
451 commentsredditother-discussionssubreddit-indexmessage modsop-focus

THE USUAL REMINDERS

  • All of our rules, FAQs, resources, etc. are in our [community wiki](https:...

... view full text

since 1 year, 1 month ago
4 of 4

Tip Reveddit Real-Time can notify you when your content is removed.

your account history
(check your username's removed content. why?)
Tip Check if your account has any removed comments.
view my removed comments
you are viewing a single comment's thread.
view all comments
[–]musifter10 points1 year, 1 month ago* (edited 3 hours, 46 minutes after)

[LANGUAGE: dc (GNU v1.4.1)]

Just part 1. This is something you probably don't want to run. Dc does not have an XOR, I quickly implemented a 24-bit one (brain foggy day so its not the most efficient), and it took 90 minutes to run (on 15-year-old hardware, you'll probably have better).

dc -e'[0d[3R4R2~3R2~3R-d*4Rd2r^3R*5R+r1+d24>L]dsLx3R4R++s,]s^?[2000[rd64*l^xd32/l^xd2048*l^xr1-d0<I]dsIx+lp+sp?z0<M]dsMxlpp' <input

Code: https://pastebin.com/pJz5nz2H

I was able to test it in much less time though, because many years ago, I embedded Perl in an older version of dc (v1.3) and still have that executable around from when I brought that out for AoC a few years ago. It required some maintenance then (the details for embedding Perl had changed a bit) to get it to compile, but it seems to work fine. I really should embed Perl properly in a newer version, because its convenient and cool.

Anyways, that allowed me to replace the dc XOR function with:

  { #2!# (int($_[0]) ^ int($_[1])) & 0xffffff } s^

(The part in #s at the start tells it to only look at the top two elements, and pop (!) them... so this pops the top 2, and pushes the 24-bit XOR of those.)

So, I suppose this means that I have used a "language" (well, dialect) that I created this year. So, [LANGUAGE: edc] I guess (extended dc... that's what I called it). This allows the thing to complete in 90s instead of 90m. So that's the lower bound on what can be gained by improving the XOR implementation.

permalinkhide replies (2)author-focusas-ofpreserve
[–][deleted]6 points1 year, 1 month ago
[removed] mod/auto

[removed] content loading...

(check your username's removed content. why?)
spin
permalinkparentcontexthide replies (1)as-ofmessage mods
[–]daggerdragon0 points1 year, 1 month ago

Comment removed due to naughty language. Keep the megathreads professional.

permalinkparentcontextauthor-focusas-ofpreserve
[–]musifter1 point1 year, 1 month ago* (edited 5 hours, 23 minutes after)

Here's a faster version pulling out the stops. And by stops we mean making the code a long mess, because we're pre-allocating all the constants. That way they're parsed and created only once, and then copied from a registers (which is much, much faster).

The other thing I did was improve the XOR function quite a bit, by using the formula I have for a 2-bit XOR ((a + b*(-1)a) % 4) instead of a 1-bit XOR (like (a-b)2).

The overall effect is that this runs in 1/3rd the time of the original (so 30m).

    dc -e'0s0 1s1 2s2 3s3 4s4 5s5 64sa32sb2048sc2000sd24se_1sf[l0d[l3Rl4Rl4~l3Rl4~l3Rdlfr^l3R*+l4dl3R+r%l4Rdl2r^l3R*l5R+rl2+dle>L]dsLxl3Rl4R++s.]s^?[ld[rdla*l^xdlb/l^xdlc*l^xrl1-dl0<I]dsIx+lp+sp?zl0<M]dsMxlpp' <input

Code: https://pastebin.com/c3idjSMM

permalinkparentcontextauthor-focusas-ofpreserve
r/revedditremoved.substack.com
🚨 NEWS 🚨
✖︎

Important: Reddit Changed How Removals Work

A recent Reddit update makes mod-removed content disappear from profile pages, which breaks Reveddit's website.

Install the browser extension to receive removal alerts.

Add to chromeAdd to firefox

What changed?

r/revedditremoved.substack.com