zwegner's comments

zwegner | 4 years ago | on: Leveraging SIMD: Splitting CSV Files at 3Gb/S

Good points all around. Not sure what the OP's requirements are, but judging by their current code, CLMUL should do nicely (or they have a bug).

And also, thanks for that example. Clearly I don't know CSV well enough--are quotes in fields that don't start with a quote not special?

zwegner | 4 years ago | on: Leveraging SIMD: Splitting CSV Files at 3Gb/S

CLMUL in general is a bit weird to wrap your head around, but a CLMUL with -1 isn't too tricky: it's like a running 1-bit sum, or in other words, each bit in the result is the parity of all the bits up to that point in the multiplier.

> In our tests, going byte to byte for more iterations to keep the alignment when hitting the "else case" performed worse than making the unaligned loads, but as you say "just use CLMUL" (as all loads will be aligned) :D

I was talking about using bitwise operations with the quote/escape/newline masks already computed (like in the blog post I linked), rather than a byte-by-byte loop. But yeah, CLMUL is better anyways :)

zwegner | 4 years ago | on: Leveraging SIMD: Splitting CSV Files at 3Gb/S

Pretty similar article from very recently: https://nullprogram.com/blog/2021/12/04/

Discussion: https://news.ycombinator.com/item?id=29439403

The article mentions in an addendum (and BeeOnRope also pointed it out in the HN thread) a nice CLMUL trick for dealing with quotes originally discovered by Geoff Langdale. That should work here for a nice speedup.

But without the CLMUL trick, I'd guess that the unaligned loads that generally occur after a vector containing both quotes and newlines in this version (the "else" case on lines 34-40) would hamper the performance somewhat, since it would eat up twice as much L1 cache bandwidth. I'd suggest dealing with the masks using bitwise operations in a loop, and letting i stay divisible by 16. Or just use CLMUL :)

zwegner | 4 years ago | on: Chess.com vs. Lichess

Is the performance difference of PEXT vs. the classic 64-bit magic bitboards actually close to 50%? The very slight latency increase of and/multiply/shift instead of pext should be somewhat offset by somewhat smaller tables (since magic hashing can have helpful collisions), right?

I should probably know this, since I "discovered" PEXT bitboards, but I got out of computer chess before I got BMI-capable hardware, and so I never actually implemented them :)

zwegner | 4 years ago | on: Log4Shell Log4j vulnerability (CVE-2021-44228) – cheat-sheet reference guide

> If exceptions are being logged with any level of detail, and an attacker has the ability to provoke exceptions while varying error message content, then the thing that seems safe was just made quite unsafe.

Right, I would certainly include that in "user data" though. I was mainly responding to the idea that using two logging libraries is strictly worse than one: when log4j is only used for logging safe data, and another library elsewhere, this is better than using log4j everywhere.

zwegner | 4 years ago | on: Zelda 64 has been fully decompiled

zelda64.com was also the official website when Ocarina of Time came out, presumably because, at the time, the zelda.com domain was already taken by a porn site. That was an interesting discovery for 10-year-old me.

zwegner | 4 years ago | on: Acquisition of chess knowledge in AlphaZero

Or even without using any such new technology, it could at least take advantage of the fact that almost all human communication is mediated by computers, and coerce virtually the entire human race into helping it. I think the GP wasn't being nearly creative enough when thinking about the possibilities/dangers of AGI.

zwegner | 4 years ago | on: The Making of Donkey Kong 64 (2019)

I enjoyed DK64 as a kid, but after replaying it recently, IMO it doesn't hold up too well. The collecting isn't bad (though the character switching makes it much worse). My main issue is the core gameplay/controls. Moving around feels unresponsive and sluggish, the action animations are really long, and hitboxes can be unintuitive. Banjo-Kazooie is better, but still not very snappy control-wise.

Super Mario 64, OTOH, holds up remarkably well: the controls flow so much faster and easier. It just feels natural to move around, with much less frustration. The camera is the biggest negative there, but that's a tough problem to solve for 3D open-world platformers, so I cut them some slack.

zwegner | 4 years ago | on: Bespoke Synth 1.0 – open-source software modular synthesizer

I really don't think being accessible to non-programmers is the cause of my issues. If anything, I'd say that targeting non-programmers might exacerbate these issues, because those users would be less likely to realize how unintuitive some aspects of Max are, thinking it's because programming in general is difficult.

I didn't touch too much on the specifics in my post, but there are lots of little design oddities I ran into when doing relatively simple tasks. Like creating a multiplexer for messages: the [switch] object has an "empty" channel for input 0 (and regular inputs are 1-indexed), so you'll often need an extra +1 object for the control input. And the inputs of [switch] have no memory, so every time the control changes, you need to send a bang to resend the message in the now-active channel. Or say you want to multiplex signals. That uses the [selector~] object (why not [switch~]?), and has the same +1 issue as [switch]. But what if you want a short crossfade when switching inputs to avoid harsh transients? "Good luck" is all I'll say here.

I'm not generally trying to do anything super-complicated with Max. I have indeed used the C extension API when it makes sense (building a wavetable synth), and it was OK. I still contend that the main visual programming environment is not very good, for programmers and non-programmers alike.

...anyways, all that said, Scheme For Max looks really cool :)

zwegner | 4 years ago | on: Bespoke Synth 1.0 – open-source software modular synthesizer

No problem! Maybe I'm just being too negative, after all there are lots of people having fun creating stuff with it (and I like having the devices I've made). But there was definitely a big impedance mismatch of what I had in my head vs. how to implement it, so I wouldn't personally use it for any exploratory sandbox-y type stuff.

zwegner | 4 years ago | on: Bespoke Synth 1.0 – open-source software modular synthesizer

I only found out about Bespoke a few minutes ago, but I will say using Max as a programmer can be incredibly frustrating. I've made a handful of nontrivial M4L devices and have run up into tons of weird decisions, limitations, bugs, and plenty of Ableton crashes. (Caveat: this information in this post is mostly from a couple years ago and might be out of date, I haven't gotten the latest Ableton)

The JS support is really weird. It's only JS 1.6 (from 2005), and had weird glitches (like loading two instances of the same device causing the first device to stop working), and I couldn't get the timing tighter than about 30ms. Ideally you could write code that runs at audio rate.

There's also "gen", which is a Max-specific scripting language that is presumably real-time suitable through a JIT. Unfortunately you need a separate Max license to use it, even the full Ableton Live Suite doesn't give you gen support. You can sorta hack around and use it by manually editing the .maxpat files (which are almost JSON), copying from a device that uses gen, but there are lots of weird glitches going this route.

A list of a few annoying things about M4L:

* Documentation is pretty sparse and/or low quality, and weirdly split into two (help and references).

* All variables are global across devices by default, local (device-specific) variables need the prefix "---", which is barely documented

* Tons of annoying UX issues, like entering an invalid value in the inspector just reverts to the old value. You can't enter an empty string for parameter values, that reverts too (you need to enter a literal ""). Certain functionality is only available depending on whether the device is "locked", so you have to lock/unlock the view all the time if you're working with e.g. subpatchers

* Abstraction is quite annoying to do. There's three different types of patches, and it's not really clear what the difference is between them. Creating subpatches and then duplicating them creates two different subpatches--changes in one are not shared with others.

* ...and a ton of other things. I have a big text document of these gripes I was intending to turn into a blog post, but haven't gotten around to it.

Maybe I'm wrong and there's better ways to do some of these things, but overall my experience learning M4L was pretty bad. If it wasn't the only way to do certain advanced things in Ableton, I'd never touch it again.

zwegner | 4 years ago | on: Ask HN: How do I reliably prevent autoplay in Firefox 91?

Right, and as the wiki mentions, it's not a great solution overall. But at least it works for me for Twitter (and Twitter is still trying to autoplay on scroll, the play button on videos disappear while scrolling only to reappear). Not sure why it works actually, but it's better than going in the Twitter settings all the time or dealing with autoplay.

zwegner | 4 years ago | on: Ask HN: How do I reliably prevent autoplay in Firefox 91?

The solution I use is to set media.autoplay.blocking_policy to 2 in about:config (I found this on the Mozilla wiki [1]). This setting requires a click to play media.

Incidentally, I browse Twitter while logged in, but the autoplay settings are "per-browser", and Firefox's anti-fingerprinting mode makes Twitter think you're using a new browser on each visit, and thus keeps autoplaying all the time without the above setting. Pretty irritating.

[1] https://wiki.mozilla.org/Media/block-autoplay

zwegner | 5 years ago | on: From Vim to Emacs in fourteen days (2015)

FWIW Neovim has shipped with libvterm as a built-in terminal emulator for years now, I think since 2015? It's the main reason I switched from vim to neovim. Vim itself integrated libvterm somewhat later, too.

zwegner | 5 years ago | on: Open source projects should run office hours

Oh, don't get me wrong, I definitely think it's helpful to explain the idiom for those not familiar. I just found the description "a lot of the comments..." rather weird when I didn't see any.

zwegner | 5 years ago | on: Open source projects should run office hours

Do any of the comments actually make that conclusion? The other comment you replied to is the only one I saw that even comes close, but it mentions "if you can offer office hours..." so the poster clearly knew the "office hours" idiom.
page 2