zkxs's recent activity
-
Comment on Day 4: Printing Department in ~comp.advent_of_code
-
Comment on Day 4: Printing Department in ~comp.advent_of_code
zkxs LinkRust Part 1, 69 µs - Simple 3x3 kernel sliding over every "pixel". I started doing a GPU implementation, which I've never done before and I was horrified at how much boilerplate code it requires,...Rust
Part 1, 69 µs - Simple 3x3 kernel sliding over every "pixel". I started doing a GPU implementation, which I've never done before and I was horrified at how much boilerplate code it requires, and that just setting up the GPU pipeline takes ~100ms. I ditched that idea before I even made it past the GPU example code and went back to the CPU...
Part 2, 847 µs - Smallest tweak I've had to make yet for a part 2--I just remove
@s as I go and keep looping until no more@s are removed in a pass. I thought briefly about getting fancy and trying to track cells that had changes, but I think the move here is just to place my trust in the CPU cache and keep the loop doing a simple linear traversal over memory? I'm not certain about that, though. -
Comment on Day 1: Secret Entrance in ~comp.advent_of_code
zkxs Link ParentHey, if the end goal is to learn then I don't think it's really cheating if peeking at what other people are doing helps with that. I've been reading a bit about why the guy who runs AoC changed...Hey, if the end goal is to learn then I don't think it's really cheating if peeking at what other people are doing helps with that. I've been reading a bit about why the guy who runs AoC changed some things this year, like removing the global leaderboard. I'm a big fan of that, because I don't think it's healthy when the goal for something like this becomes winning. I think it's better when people are solving puzzles to hone skills vs climb leaderboards.
-
Comment on Day 3: Lobby in ~comp.advent_of_code
zkxs Link ParentWhen you do let temp_line = line.expect("") you aren't copying the line--you're unwrapping the Result<&str, Error> to get to the &str inside. Unlike most languages where assignment does a...When you do
let temp_line = line.expect("")you aren't copying the line--you're unwrapping theResult<&str, Error>to get to the&strinside.Unlike most languages where assignment does a copy-flavored thing, in Rust it does a move-flavored thing. So that string isn't getting copied! That's why the compiler isn't letting you use
lineanymore after that point--it's gone, because you moved it intotemp_line. -
Comment on Day 3: Lobby in ~comp.advent_of_code
zkxs Link ParentRust's strings take a little getting used to. It's mostly because they're UTF-8 aware, meaning a char can be more than one byte long, and also that not all byte sequences are valid Strings. In a...Rust's strings take a little getting used to. It's mostly because they're UTF-8 aware, meaning a char can be more than one byte long, and also that not all byte sequences are valid Strings.
In a context like Advent of Code where all the inputs are normal ASCII text this UTF-8 support is a bit overkill, which might explain your feeling that things aren't quite right.
AoC seems like a great way to get used to Rust's quirks though, I hope you have fun and learn some new tricks! Definitely don't let other people's fancy solutions wig you out--we're all here for different reasons and with different backgrounds. (Do let the guy who's doing it all in Excel wig you out though, that's crazy)
-
Comment on Day 3: Lobby in ~comp.advent_of_code
zkxs Link ParentDaaang, that's nice. I thought what I had was fast at 158 µs, but for part 2 your dynamic programming approach is ~1.7x faster at 90 µs, and it gets the part 1 solution for free to boot. If I had...Daaang, that's nice. I thought what I had was fast at 158 µs, but for part 2 your dynamic programming approach is ~1.7x faster at 90 µs, and it gets the part 1 solution for free to boot. If I had to guess, I'd bet your complete lack of any branching is what gives it that boost, as I ended up with an unfortunate branch I couldn't figure out how to eliminate.
-
Comment on Advent of Code starts tomorrow/tonight! Are you participating? Do you have any specific plans for this year? in ~comp.advent_of_code
zkxs LinkI've never done Advent of Code before. Normally I'm not super interested in puzzles, but I took a peek at day 1 part 1 and it looks like a fun optimization challenge. I do want more practice...I've never done Advent of Code before. Normally I'm not super interested in puzzles, but I took a peek at day 1 part 1 and it looks like a fun optimization challenge.
I do want more practice optimizing code, so I'm thinking I'll give AoC a go this year and see how fast I can get my solutions running.
-
Comment on Day 3: Lobby in ~comp.advent_of_code
zkxs LinkRust Part 1 - After day 2 nerd-sniped the hell out of me I was braced for something crazy, but this puzzle solved easily with a simple byte-by-byte traversal. Part 2 - I was pleasantly surprised...Rust
Part 1 - After day 2 nerd-sniped the hell out of me I was braced for something crazy, but this puzzle solved easily with a simple byte-by-byte traversal.
Part 2 - I was pleasantly surprised that making my part 1 solution generic to an arbitrary number of batteries was very straightforward, and the performance impact for the extra math needed to set up the inner loop is almost negligible.
-
Comment on Day 2: Gift Shop in ~comp.advent_of_code
zkxs LinkRust Part 1 - This was a weird puzzle for me: I don't do a lot of generating strings that match a pattern—usually it's the opposite, where I check if a string matches a pattern. For performance,...Rust
Part 1 - This was a weird puzzle for me: I don't do a lot of generating strings that match a pattern—usually it's the opposite, where I check if a string matches a pattern. For performance, generating is definitely the way to go here vs brute-force scanning all the ranges for invalid IDs. After a lot of fiddling I was able to get an invalid ID generator working, and it's pretty fast!
Part 2 - I took one look at part 2 and decided I didn't want to re-do all that fiddling to make my solution more generic. 😭 This is just naive brute-forcing and it's many orders of magnitude slower than it ought to be.
-
Comment on Day 1: Secret Entrance in ~comp.advent_of_code
zkxs Link ParentWell, I wasn't planning on posting, but if there's folks out there who want to look at more Rust implementations who am I to deprive you? I've been using Rust for long enough getting a solve isn't...Well, I wasn't planning on posting, but if there's folks out there who want to look at more Rust implementations who am I to deprive you? I've been using Rust for long enough getting a solve isn't a huge issue, so my goals here are to play around and see how optimized of a solution I can get.
Part 1 - I'm pretty happy with how the
reversedimplementation came out. It's fast and quirky!Part 2 - Tragically the weird trick I used in part 1 didn't carry over, so this was mostly just an exercise in getting used to how
div_euclidbehaves. -
Comment on Nexus Mods ownership changing hands: An update from Dark0ne in ~games
zkxs LinkAh, I anticipate that we'll be getting to the "fun" part of Nexus Mods' ToS soon. I suspect this is going to become a similar situation to all the wikis struggling to migrate off of Fandom....Ah, I anticipate that we'll be getting to the "fun" part of Nexus Mods' ToS soon. I suspect this is going to become a similar situation to all the wikis struggling to migrate off of Fandom.
Relevant part of the Nexus Mods ToS is quoted below:
When you upload or post content to our site, you grant us the following rights to use that content:
- a worldwide, non-exclusive, royalty-free, transferable licence to use, reproduce, distribute, prepare derivative works of, display, and perform that user-generated content in connection with the service provided by the website and across different media including to promote the site or the service forever;
- a worldwide, non-exclusive, royalty-free, transferable licence for our partners and advertisers to use the content for their purposes and in accordance with the functionality of the site forever;
- a worldwide, non-exclusive, royalty-free, transferable licence for other users to use the content for their own recreational purposes only and in accordance with the purpose of the site (that is, to enable users to download video game mods for their personal use and enjoyment) forever.
In particular, we may retain your content indefinitely and are not obliged to delete your content if you so request. The rights you grant us continue after this agreement is terminated or your access to the site is withdrawn by us.
That is an incredibly permissive license to modders' work. In fact, while I'm not a lawyer, I believe it waives all of the protections copyright normally grants creators over their work.
Oh, and of course this license is conveniently transferable so when they're acquired by an evil equity firm all the IP they've collected rights to is part of the deal.
-
Comment on Donald Trump says he'll 'likely' give TikTok a ninety-day extension to avoid US ban in ~tech
zkxs Link ParentDisclaimer: I work for Oracle and my opinions are my own. I may have bias. My specific work is not directly involved with TikTok, so I'm not privy to any information you aren't. However, from what...Disclaimer: I work for Oracle and my opinions are my own. I may have bias. My specific work is not directly involved with TikTok, so I'm not privy to any information you aren't.
However, from what I know there are restrictions surrounding how China can access the US-housed data: https://usds.tiktok.com/usds-about/, so I'm not sure "[data] ...that China can access at any time" is accurate.
-
Comment on Inside the "three billion people" National Public Data breach in ~tech
zkxs Link ParentThe US population is ~333M and with 273M distinct SSNs in the dataset (some unknown number of which are for deceased individuals) there's decent odds that any given person isn't in there. There's...The US population is ~333M and with 273M distinct SSNs in the dataset (some unknown number of which are for deceased individuals) there's decent odds that any given person isn't in there. There's also definitely some garbage data in the dataset, so there's some unknown percentage of those SSNs that are just wrong. But yeah, this breach is quite large.
In a twisted way I was actually hoping this breach would be larger, because we really need something to get companies to stop using SSN as an ID number when it was never built to be secure. CGP Grey has a video on this topic that while 7 years old is still accurate https://www.youtube.com/watch?v=Erp8IAUouus
-
Comment on Inside the "three billion people" National Public Data breach in ~tech
zkxs Link ParentIf anyone is trying to get their hands on the files and wants to know if they have the right stuff here are the sha256 checksums: 5d4ab848129e55042c5b6bd3f74a115b26472a184b0f4d0d4b0728e00e1d08ec...If anyone is trying to get their hands on the files and wants to know if they have the right stuff here are the sha256 checksums:
5d4ab848129e55042c5b6bd3f74a115b26472a184b0f4d0d4b0728e00e1d08ec *NPD202401.7z f6bd4edf8fc484d8d6697f13924c7c0108e453b2dbbc6981c767050ece561237 *NPD202402.7zI calculated these from the files I downloaded from the magnet link, and someone else who downloaded them from the original source (not the magnet link) also claims those hashes are correct.
I haven't had time to do a whole lot of data crunching yet as I'm having a wee bit of trouble working with 276 GB of data, but I count 272,541,507 distinct SSNs in 2,695,681,513 rows. That's 10% of rows with a unique SSN.
Curiously, that's quite different from Troy Hunt's estimate of 899M distinct SSNs.
-
Comment on Inside the "three billion people" National Public Data breach in ~tech
zkxs Link ParentIt's not unreasonable to think, especially because 7z also had some security issue 2 years back: https://nvd.nist.gov/vuln/detail/cve-2022-29072 I decompressed the 7z archives using a pure-rust...It's not unreasonable to think, especially because 7z also had some security issue 2 years back: https://nvd.nist.gov/vuln/detail/cve-2022-29072
I decompressed the 7z archives using a pure-rust lzma implementation just to see if it would do anything unusual and for what it's worth it didn't. I don't think it's a 7z 0-day.
-
Comment on Reddit communities are switching to NSFW to create some friction and rob Reddit of ad revenue in ~tech
zkxs Link ParentApparently the /r/mildlyinteresting moderators were removed by mistake, as absurd as that sounds, according to this comment on /r/ModSupport which appears to be from a member of the mod council. I...Apparently the /r/mildlyinteresting moderators were removed by mistake, as absurd as that sounds, according to this comment on /r/ModSupport which appears to be from a member of the mod council. I guess the Reddit admins are having a tough time telling /r/mildlyinteresting and /r/interestingasfuck apart...
-
Comment on Beehaw.org: defederating effective immediately from lemmy.world and sh.itjust.works in ~tech
zkxs (edited )Link ParentOut of curiosity, why not use an account on an instance that federates with both beehaw and lemmy.world?Out of curiosity, why not use an account on an instance that federates with both beehaw and lemmy.world?
-
Comment on Beehaw.org: defederating effective immediately from lemmy.world and sh.itjust.works in ~tech
zkxs Link ParentThat's actually pretty confusing to me, as you don't need multiple accounts. I have a single Lemmy account on lemmy.sdf.org which presently has completely open federation. Meaning that I can...And the answer can't be to just register multiple accounts like people suggest in the comments there.
That's actually pretty confusing to me, as you don't need multiple accounts. I have a single Lemmy account on lemmy.sdf.org which presently has completely open federation. Meaning that I can access, post, and comment on content from BeeHaw, lemmy.world, sh.itjust.works, anywhere. And the fact that the comments on Lemmy are so overrun with the sentiment of "I now need a BeeHaw and a lemmy.world account" is wild, as it shows that all of those vocal commenters have a big gap in their understanding of how federation works.
-
Comment on Beehaw.org: defederating effective immediately from lemmy.world and sh.itjust.works in ~tech
zkxs Link ParentI'm seeing a lot of posts along the lines of "tankies bad, lemmy devs are tankies, therefore lemmy bad" which strikes me as an incredibly fallacious argument. Maybe there's some critical context...I'm seeing a lot of posts along the lines of "tankies bad, lemmy devs are tankies, therefore lemmy bad" which strikes me as an incredibly fallacious argument. Maybe there's some critical context I'm missing somewhere, but the more I see that same argument, again and again without context, the more I suspect that the context doesn't exist.
I'm not a huge fan of using an anonymous mastodon user as my only source, especially one who for some reason says "I have receipts, DM me if you want to see them for yourself" instead of you know, citing their sources. So I've done some looking around to see if there's anything with a bit more detail.
The very same Lemmy instance this post is about, beehaw, has a well thought-out post regarding the politics of the two Lemmy developers, "On Politics and Forking", which seems pretty relevant here.
One of the two Lemmy developers wrote a "Statement on Politics of Lemmy.ml", where they straight up say they're communists. But they also present a very reasonable narrative that they keep their politics out of Lemmy decisions and call out the Lemmy Code of Conduct, which certainly appears to be a safe, apolitical document to me.
My personal take here is that if the Lemmy devs can, in fact, keep their politics and Lemmy development separate then why not use the project? I'm wouldn't donate to the Lemmy devs, especially not if it would fund the hosting of Lemmy instances that are a safe haven for extremist communist rhetoric, but it seems to me that simply using the code doesn't promote political extremism.
Finally, this is a bit of an aside, but this situation also reminds me of a post by an Invidious contributor, TheFrenchGhosty: "I'm Not Invidious". For context, Invidious is an open source alternative frontend for YouTube, which unsurprisingly Google is not very happy about. TheFrenchGhosty's argument is that as an open-source project with numerous contributors, no one person "owns" Invidious. Obviously TheFrenchGhosty has a vested interest in not being considered an owner of Invidious due to the cease-and-desist Google sent them. But regardless of TheFrenchGhosty's bias, I think it's a pretty valid approach to think of FOSS code as being ownerless.
-
Comment on Are "Ask" posts stifling the visibility of link posts on Tildes? in ~tildes
zkxs LinkDefinitely. I'm completely unsurprised though, as this is Activity sort working as designed. Ask posts are naturally going to have a lot of discussion and be continually bumped up. As Activity is...Have other users noticed this? How do you feel about this shift?
Definitely. I'm completely unsurprised though, as this is Activity sort working as designed. Ask posts are naturally going to have a lot of discussion and be continually bumped up. As Activity is the default sort, it's naturally going to funnel folks who don't play with the alternative sorts into those Ask discussions, creating a feedback loop.
I think this is fine, as it's still easy to discover other types of post by using any other sorting algorithm, ignoring ask posts you aren't interested in, or even completely filtering out the
asktag entirely.Is there any merit to having a group dedicated to ask posts? Sort of like /r/AskReddit, but for Tildes? (That way, the posts can be easily filtered if a user wants to only see link posts.)
I don't think so, as it doesn't make sense to group posts by "ask" instead of their larger category. I'd expect a tech-related ask post to be in ~tech. And again, users can filter out the
asktag entirely if they want.Should the visibility of link posts and ask posts on the front page be artificially balanced in some way?
That's not a bad thought. A new sorting algorithm with slightly more elaborate logic than Activity, or even a slightly tweaked Activity could do a lot to reduce the disproportionately high position Ask posts are getting. For example, if Activity sort excluded non-root comments in its "bump" logic specifically for Ask posts.
There's a lot more detail in how the sorts work in the Tildes Front Page documentation.
Benchmarking is one of those things that looks pretty simple on the surface (just time it, right?) but actually goes decently deep. The general idea is you don't just measure the code once--you run it in a loop many many times so that you can see how long it takes on average. You also want a warmup phase in which you don't measure the first few seconds of looping. JIT-compiled languages need this warmup because they need to optimize the code, but even AoT-compiled languages need it because the computer has a bunch of sneaky caches lying around in the filesystem and the CPU that you want warmed so your timing becomes consistent. You've also got to be careful that the compiler doesn't notice your benchmark setup isn't using the result of the computation, lest it optimize the computation away completely.
It's very likely that most of that time you're measuring is due to the JS interpreter not being warm, so it's super unfair to compare it to the AoT language gang where we don't have that problem... and also I'm using a benchmarking framework that's making sure all those other sneaky caches I mentioned are also warm.