glangdale
Joined 11 years ago
Joined 11 years ago
The fastest way to detect a vowel in a string on any reasonable architecture (Intel or AMD equipped with SIMD of some kind) is using 3-4 instructions which will process 16/32/64 (depends on SIMD length) bytes at once. Obviously access to these will require using a Python library that exposes SIMD.
Leaving SIMD aside, a flat byte array of size 256 will outperform a bitmap since it's always faster to look up bytes in an array than bits in a bitmap, and the size is trivial.
If you have AVX-512, GFNI is faster for this task, but obviously many situations where you can't use it.
This has a huge impact on trying to hook actions, call-backs, etc (your "arbitrary procedure") to NFA states as you're frequently making many overlapping entries to these states, many of which go nowhere. Trying to figure out which entries correspond to which other entries isn't easy.
There are very stylized automata that are used in parsing that do interesting things beyond the finite automata space (like pushing things onto a stack), but they don't correspond to regex per se - instead they are generated from a grammar.
Doing the CSV version of the quote convention is actually wildly easier than the JSON version, as you can just treat a record like "foo""bar",hi,1,"hatstand,teakettle" as having 'left the quotes and rentered the quotes" at the double-quote spot when you're busy looking for ','. This isn't, of course, much help for normalization, but for the bit where you're hoping to simply find which ',' characters are separators, it's fine to pretend that there's a gap in your "quoted stuff bitfield" that happens at the "" in "foo""bar", as of course that gap isn't going to land on a ',' anyhow. So it's much cheaper than doing a tedious shenanigan to handle some crafty user who has hit you with 100 \ characters in a row (as opposed to 99 or 101), a la JSON.
IMO the cost of doing the CLMUL all the time vs taking a conditional to handle the 'I have no quotes today' case is pretty low. It makes for shorter and more easily understood (in performance terms) code. I wasn't allowed to take this to extremes in simdjson - we did handle the "common case" for UTF-8 validation (although I wonder if that's a very culturally determined notion of "common case").
Public universities are not well-protected in the United States from conservatives seeking to defund programs with which they disagree. One might be well-protected against being fired directly for saying something controversial, but if your whole department is closed, you can be gotten rid of, even with tenure.
https://www.boisestatepublicradio.org/education/2021-04-07/l...
There's an echo chamber out there that amplifies the notion that there is some sort of epidemic of "woke cancellations" and critical race theory etc. - this is heavily emphasized by conservative media. There's plenty of ridiculous behavior by students - e.g. at Reed College - which I am aware of a massive amount of left-on-left cancellation - someone I know had their career upended by the unlimited claims of the rather stereotypically woke students there. But stupidity at places like Evergreen and Reed will beget endless think pieces and have left cancellation magnified endlessly.
Meanwhile, conservatives' own role in cancellation is minimized to the point of ridiculousness: so Bari Weiss can straight-facedly claim to be a fan of academic freedom.
There's a quieter, but considerably more effective, campaign to defund entire departments among conservatives - the model is a narrow "university as career prep". This means getting rid of the humanities and social sciences in favour of business/law/engineering/CS (good for us, I guess?).
In Australia, the conservative governments have been fairly unabashed in raising the cost of a humanities degree (paid for via our "HECS" scheme) in a way that seems pretty much Amazingly, this gets considerably less press in the echo chamber than some jackass left students acting like jackasses. I wonder why...
I'll agree with you that most of the noisiest and embarrassing cancellations are left-on-right or left-on-left, but this a narrow slice of "actions taken against academics", and their noisiness is not indicative of their effectiveness. Some of these cancellations are simply part of right-wing grift: schedule a talk from someone with credentials designed to enraged the "woke left" somewhere on their home turf, then enjoy the newfound credibility when you get cancelled and get to be a Free Speech Martyr.
https://github.com/01org/hyperscan
Worked on JSON parsing with Daniel Lemire at:
https://github.com/lemire/simdjson
Blog: branchfree.org
https://twitter.com/geofflangdale