HNHacker News
TopNewBestAskShowJobs

luizfelberti

745 karma · joined June 12, 2019

https://berti.me
submissionscomments
luizfelberti··on Simply Parse in C
Agreed on all counts, except with the remark that even with sane grammars unbounded lookahead will still appear if you want to have IDE-grade error resilience.

But I wholeheartedly agree with the sentiment of "don't make the grammar look like Scala" <3

luizfelberti··on Simply Parse in C
Depends on where you draw the line of what a parser is:

- If the parser is "the thing that comes after the lexer" then all of this is abstracted away by the lexer and you can just treat it as a span of bytes;

- If the parser is "everything that needs to be implemented to correctly transduce the input sequence into a tree", then you need to implement this yourself or have a lexer that handles this for you, usually done by having a tiny UTF-8 codepoint recognizing FSM in your lexer (UTF-8 is a self-synchronizing code, which makes this part easier) and ignoring the existence of graphemes.

Most people, however, shy away from implementing a parser "all the way down to the bytes" and properly handling UTF-8 as a formal language. Most lean on a lexer abstracting this away. Ditto for context-sensitivity.

Recently Rust's regex engine underwent a major overhaul, and burntsushi wrote a blog post[0] about doing the "all the way to the bytes" thing in the new regex engine, I highly recommend the read:

[0] https://blog.burntsushi.net/regex-internals/#nfa-optimizatio...

luizfelberti··on Simply Parse in C
Cute, now do it with UTF-8 support.

> People are terrified of parsers and parsing

And rightfully so. People who aren't afraid of them generally fail to understand all of the ways in which parsing can show fractal complexity, and will mostly stick to toy examples like this INI parser to justify their positions.

If you're gonna argue that parsing is simple, the bare minimum I'd want to see implemented is a context-sensitive grammar with unbounded lookaheads (or at the very least, that is capable of handling more than one token of lookahead), with proper support for Unicode, and actual error resilience (not what this article calls error resilience)

If you manage to do all that and can still call what you did "simple" without having completely deluded yourself, congratulations, I hope to be on your level some day.

PS1: I won't even go into the plethora of security issues originating from crappy parsers, especially those written in C

PS2: Let's also leave aside any matters related to correctness and validation of parsers, which are notoriously not by any means "simple".

PS3: Or generating decent errors for that matter.

luizfelberti··on Let us serve you, but don't bring us down
The fact that IA is so liberal with their scraping policies is laudable, because on the other end of the spectrum lies Wikimedia, where you're lucky if you manage to download their dumps at 500kbps, which makes their dumps pretty much impossible to obtain...
luizfelberti··on Deep Neural Networks from Scratch in Zig
I wonder how much of the heavy lifting on GGML can be done with `zig translate-c ggml.c`

GGML seems to be just one gigantic 10K LOC C file anyways...

luizfelberti··on WebGPU GPT Model Demo
It's really a shame that there is no 8-bit float support in the WebGPU spec. Even though few cards support it natively, it'd still massively benefit ML workloads.

Another annoying constraint but specific to wgpu (Rust's implementation of WebGPU) is that it does not support f16 yet (which IS in the spec), only through SPIR-V passthrough...

luizfelberti··on Show HN: CozoDB, Hybrid Relational-Graph-Vector Database
Thanks for the speedy response!

Cozo is looking like a top-contender for my project so far :)

luizfelberti··on Show HN: CozoDB, Hybrid Relational-Graph-Vector Database
How well does Cozo handle larger than RAM data? Does it only need to keep the query's answer set in memory?

By larger than RAM I mean the entire WikiData knowledge graph (~100GB), with something like 16GB of RAM.

Another question: any plans for supporting Parquet files with query pushdown? I honestly doubt Parquet's efficiency can be matched with RocksDB (but I'm happy to be proven wrong), and having to convert big datasets is always a pain...

luizfelberti··on Oxy is Cloudflare's Rust-based next generation proxy framework
You did mention on your Pingora post months ago that that would be open-sourced eventually though. Is that still the case? Is Oxy entirely separate from those plans?
luizfelberti··on Ask HN: What Happened to Lambda-the-Ultimate.org?
It's actually been down for over a week already (maybe even two), my guess is that they don't have the thing monitored and it'll only get fixed once it reaches the admin's ear
luizfelberti··on Why does Google use location for language rather than browser settings?
I don't even care that much about the IP vs System Language part of it tbh, what REALLY pisses me off is that despite having configured my Google Account to only show me english results, it will serve me Portuguese search results just because I live in Brazil.

That is truly maddening

luizfelberti··on Hubris – A small operating system for deeply-embedded computer systems
Refreshing to see this seems tailored for RISC-V and ARM, rather than it being just another x86 OS. RISC is the future, and the future is exiting!
luizfelberti··on Ask HN: What are you using for public documentation these days?
I've found https://js.wiki to be pretty good
luizfelberti··on Forth vs Lisp
Does TCL has a purpose since Forth exists? Serious question.

TCL being stringly typed makes it dead on arrival for me, and I'm sure others feel the same.

luizfelberti··on Rust 1.56.0 and Rust 2021
Ooh I forgot the language had those!

I still feel like this trick has it's place though, as an example take a look at where I stole this trick from, by matklad [0] and tell me what you think :)

[0] https://github.com/rust-analyzer/rowan/blob/d2c7843858da9d9e...

luizfelberti··on We Just Gave $155k to Open Source Maintainers
I'd suspect it's because Sentry offers client-side telemetry as one of their services, and they might be using the same domain for both commercial and technical stuff (hosting both the main site and backends) so blockers have no choice but to block the entire thing if the enforcement is DNS based

I'm only speculating though, as this is a pretty common mistake

luizfelberti··on Rust 1.56.0 and Rust 2021
I will shamefully admit to using transmute in very sinful ways, such as having enums that are repr(u16) or something like that at multiple numeric ranges such as:

    #[repr(u16)]
    enum Foo { A = 0, B }

    #[repr(u16)]
    enum Bar { A = 3200, B }

    struct FooOrBar(u16);
And then proceeding to violate all of the unwritten rules of Rust by wrangling casts across these types like a goddamn wizard

I'm not proud of this...

luizfelberti··on Meritocracy Is Bad
Yet despite having gone to Harvard, doesn't seem to be able to distinguish credentialism from meritocracy.

But hey! At least he went to Harvard right?...

luizfelberti··on Ask HN: Is there an easy example of a Lisp pretty-printer?
Pretty printing is a hard problem. Read Philip Wadler's paper on implementing Haskell's pretty printer [0], and then maybe study the Rust library called `pretty` [1] which is an implementation of it for tree like structures.

[0] https://homepages.inf.ed.ac.uk/wadler/papers/prettier/pretti...

[1] https://github.com/Marwes/pretty.rs

luizfelberti··on So You Want to Study Philosophy
This is a great place to recommend Standard Ebooks's excellent collection of translated Public Domain works, which includes many of the listed titles in TFA:

https://standardebooks.org/ebooks

luizfelberti··on Ask HN: Favorite purchases of last two years?
Just an FYI here for those unaware, but Sennheiser recently sold off their consumer headphone division [0], so the future of Senn's great headphones is very much a mystery at the moment

[0] https://www.theverge.com/2021/5/7/22424367/sonova-buys-sennh...

luizfelberti··on Keyboard that shocks you if you type with incorrect technique [video]
I'd second this. Switching to US ANSI layout (not US International layout) is like magic, I find it so much better that I always import my keyboards from the US, and only buy laptops if they have the US layout.

Brazil uses a national standard called ABNT2 (which I consider to be an awful format), but to my advantage, I find the way Macs do accentuation (at least for latin alphabets) to be quite sensible (alt+vowel), and get angry whenever I have to use Linux because it doesn't have "Mac accents"

For your case though, I think the Nordic alphabet might be trickier on the US layout, since it shares less common ground and there's a lot more to it

luizfelberti··on Brandolini's Law
Related to this: https://en.wikipedia.org/wiki/Inoculation_theory
luizfelberti··on Bitmessage: A decentralized and trustless P2P communications protocol
The short version would be this:

It takes a bastardized definition of "trust" to make this statement true, and it's a definition that is most often seen in the wild when used to "sell" blockchain stuff as having technical capabilities they do not, in fact, possess. It is a dishonest and misleading definition.

There are several mechanisms of trust that exist, authorities are just one of them. Reputation is another, so are proofs, and so is consensus (which is the most interesting one for the case at hand). Blockchains are essentially "Paxos, but for a massive peer count, and with some mechanisms that allow it to operate in an adversarial networks", but it is fundamentally still just a consensus algorithm (in Bitcoin's case, one where people "agree" that John Doe has X amount of money).

Shifting to P2P essentially just means that:

- You will trust a bunch of random people instead of a centralized authority;

- You will trust that these random people don't have enough "power" to subvert the protocol;

- In this context "power" refers to computational power in the case of PoW and Sybil Attacks, or access to backdoors;

- You will trust that the protocol is sound, as well as the implementation of it;

There's plenty of trust going around in there, claiming to "do away with trust" is dishonest at best, and fraudulent at worst. To add insult to injury: PoW based peer networks that haven't achieved significant scale can likely be trivially overtaken by an adversarial actors, and making a system P2P tends to open it up to all kinds of forensic network analysis.

---

For the long version of the argument I'd recommend this post from Bruce Schneier:

https://www.schneier.com/blog/archives/2019/02/blockchain_an...

> Most blockchain enthusiasts have a unnaturally narrow definition of trust. They’re fond of catchphrases like “in code we trust,” “in math we trust,” and “in crypto we trust.” This is trust as verification. But verification isn’t the same as trust.

> What blockchain does is shift some of the trust in people and institutions to trust in technology. You need to trust the cryptography, the protocols, the software, the computers and the network. And you need to trust them absolutely, because they’re often single points of failure.

luizfelberti··on Bitmessage: A decentralized and trustless P2P communications protocol
I haven't taken a look at the protocol itself, but I just want to comment on the foul and bitter taste the word "trustless" leaves in my mouth.

It could be the case that this protocol is the bee's knees, but seeing this makes me want to immediately write it off as bullshit. "Trustless" is not a thing that exists in real life, or rather, it only exists in the minds of people who fundamentally misunderstand "trust".

luizfelberti··on Linus Torvalds rails at Intel for 'killing' the ECC industry
Can we switch the url to the actual thread with Linus talking?

https://www.realworldtech.com/forum/?threadid=198497&curpost...

luizfelberti··on Tunguska: Ternary Computer Emulator (2008)
> This seems to be a reply to something, but it nos not clear to what? I saw no efficiency claims of trinary on the Tunguska page, so this seems unrelated to it

Sorry if it seems like it's just a floating comment, indeed the article made claims of the kind, and I really think the project (and others like it) is nice. My comment is directed towards the practical concerns and real-world feasibility of a ternary computer, especially with regards to comments that threads like this inevitably attract (as seen on this comment section) that "ternary computers would revolutionize X", and is partly fueled by me having had non-fuitful conversations with coworkers that insisted on this point in the past. Hopefully this helps contextualize my comment a bit better.

> That said, I don't understand how you arrived at [point 3b]. One can definitely create a circuit which will perform a ternary operation in a (some) constant time. The real question is: can you make a ternary computer which is somehow better than a binary one?

I think you and I are in agreement here, so let me try to clarify what I meant:

My point is precisely regarding the arbitrariness with which "constant time" is defined. Asymptotic analysis of algorithms always treats complexity in the "time" dimension as a measurement of discrete "ticks" on computational state, meaning: you can pick any encoding of data you want, and any set of operations you want, and have any "operation" execute instantly as a tick. When analysing "ticks", an algorithm might seem extremely efficient, however that might be a non-reifiable performance gain when you translate from ticks to milliseconds.

For example: assume a binary NAND gate takes 1ms to propagate a stable output signal. All other conditions being equal with respect to manufacturing technology, voltage, and other things you mentioned, I don't see how you could perform "more" computation at the same cost. Sure you can implement a ternary gate that runs in "constant time", but would that constant time still be 1ms? If yes, would it take up the same amount of die space? If yes, would it consume the same amount of power and dissipate the same amount of heat? etc

You'll eventually be tickling the Landauer limit [0] for whatever your manufacturing technology is at some point, no matter if you're doing binary or whatevernary logic, but getting "more compute" for free would be cheating thermodynamics. Improving manufacturing technology is, of course, a viable strategy for squeezing "more computation" into the same physical space, but switching bases will not immediately make Moore's law wither away.

A more succinct way of putting what I'm trying to say into words I guess would be that "all other things being equal, the choice of base is arbitrary with regards to computational and representational power"

Hopefully this helps clear things up :)

[0] https://en.wikipedia.org/wiki/Landauer%27s_principle

luizfelberti··on Tunguska: Ternary Computer Emulator (2008)
I just wrote a very detailed comment on this thread on why ternary computers aren't a thing, probably can't be a thing, and thus will probably never become a thing.

You might want to read it: https://news.ycombinator.com/item?id=25618303

luizfelberti··on Tunguska: Ternary Computer Emulator (2008)
I think ternary computers are an interesting thought excercise, but I've heard on multiple occasions people making serious comments about "ternary computers would be a revolution in computing/efficiency/<something>", and it always sounded like crackpot speculation to me.

I'd be interested in hearing a sophisticated counter-argument if anybody has a good one. Here's my take on this:

1. Binary is that smallest base in which we can encode Shannon information, and thus yields to "bits" a more elegant foundation for computation. Choosing any other base sounds like it would be a very arbitrary choice, and to the best of my knowledge, the only other canonical base for computation that inherently makes sense (as in, not arbitrary) aside from the `bit` is the `nat`[0], but since it uses Euler's constant (a transcendental number) it would be (ironically) very unnatural to express "computation" in it.

2. By theorem, all bases are equivalent in power with respect to their capabilities of encoding information and processing/computing said information, and binary logic can be used to bootstrap any other multi-valued logic system desirable (goes for ternary logic and 64-bit integer computation alike). Thus, the decision to make a base-3 falls back pretty much entirely on circuit efficiency ...

3. The claims of computational efficiency, as far as I've been able to observe, are fallaciously constructed by studying their performance characteristics in abstract computer models that are completely detached from computational thermodynamics:

3a. Turing-machines, for example, fail to adequately model real-world constraints due to information locality being one-dimensional (while the real world is 3D). Von-Neumann computers (and other RAM based machine models) are IMO the largest infractor of this — there is no such thing as "RAM" in the real world: you can't access any address space irrespective of locality in O(1), such a computer would violate relativistic physics and thermodynamical constraints, RAM can only exist by making all memory access equally inneficient and mitigating that as much as possible with L3 caches and what not. Semiconductor engineers and chip designers inherently understand this and are aware of die-locality, most computer scientists and software engineers are completely oblivious to this and get to ignore it most of the time [1]

3b. This means that even though anyone can theorize an abstract machine where every discrete "tick" of time will perform a ternary operation in constant time, that doesn't mean such a machine can be efficiently reified if you move it out of the realm of abstraction. We could just as easily theorize a computer that uses base-1T (one trillion), and assume that all "trilliernary" operations execute instantly in discrete ticks of O(1), and voila! We have a computation device that can rival all of Google's data-centers!

3c. In the real world however, there are thermodynamic constraints on how information can "flow" across spacetime, and I have seen absolutely zero evidence that a ternary, trilliernary, or whatevernary logic gate can be constructed without introducing many new voltage levels or other circuit fuckery to counteract this, in a way that wouldn't completely wreck any purported efficiency. It's either that, or we'd implement whatevernary logic using binary gates (which is exactly what 64-bit integer arithmetic already is!)

4. Bottom line and TLDR is this: You can't get more computation[2] for free. Welcome to the real world.

---

[0] https://en.wikipedia.org/wiki/Nat_(unit)

[1] This is especially painful to watch when they are forced to deal with it, and these optimistic-assumptions clash with reality, as evidenced by NUMA bottlenecks wrt RAM/RDMA/GPUs/Disk access, a collective failure of most engineers to understand the CAP theorem or other concepts related to networking, and so on...

[2] And by "computation" I mean it in the thermodynamical, relativistically-physical, information-theoretical kind of way. Physics is a thing we forget about way too often in computer science...

luizfelberti··on Cloudquery: Easily ask questions about your cloud infrastructure
Damn this looks really good. Data-first SQL integrated interfaces always get a +1 from me, managing resources without unified abstractions is always painful, especially when you have to do this at scale, standard CLIs always end up falling short in some way

Also, relevant tool for similar applications (albeit not SQL based): https://github.com/cloud-custodian/cloud-custodian

← PreviousPage 2 of 5Next →