HNHacker News
TopNewBestAskShowJobs

fovc

1,249 karma · joined October 9, 2014

submissionscomments
fovc··on Terence Tao on proof checkers and AI programs
I’m pretty sure that 2nd proof exists in some book or ebook somewhere. generating functionology was the one that came to mind.

Impressive recall, but not novel reasoning

fovc··on Quill v2 – Rich text editor
No experience with Jason, but I have to say I’ve spent waaay too much time reading the Quill code trying to figure out how to patch around weird behavior. Which is frustrating because that’s what a RTE library (vs roll your own) is supposed to be. Not sure about v2, but the v1 code is just not very well architected.

There are basic features we’ve held off on implementing for fear that it will lead to a million little bugs.

The Delta format is the best thing about Quill by far. But I’d advise anyone looking for more than bold/underline/italics to use prose mirror.

fovc··on I discovered a critical exploit in ZeroMQ with mostly pure luck
> As a software engineer, I am lazy, so I always love to reuse existing tools as much as possible… That’s why I decided to take the chance to learn how Elliptic Curve Cryptography works.

Imagine if they weren’t lazy!

fovc··on Ask HN: Startup Devs -What's your biggest pain while managing cloud deployments?
100% and going one step beyond: how do the answers to those Qs evolve as you grow from 1 engineer to 5 to 20 etc.
fovc··on Macaroons Escalated Quickly
Ah thanks for clarifying! I knew the code was illustrative but didn't realize the JSON part was too
fovc··on Macaroons Escalated Quickly
Surprised to see JSON here. I recall discussing JWT with tptacek a few years ago, and one of the concerns was the {a: x, a: y} ambiguity in JSON parsers. Was that a concern with this design?

My other reaction was that this sounds scary:

> a token with no caveats restricts nothing. It’s a god-mode token. Don’t honor it.

I guess it's technically "fail closed" but seems kind of brittle

fovc··on AlphaGeometry: An Olympiad-level AI system for geometry
Heh, can’t edit now, but s/Deep Mind/Deep Blue/
fovc··on AlphaGeometry: An Olympiad-level AI system for geometry
As a consumer of those problems, first of all, thank you! Even decades on from high school I occasionally enjoy working on them.

But agree that geometry was obviously going to be first. From what I’ve gathered here, it’s not “brute forcing” in terms of relying on algebraic geometry, vectors, or complex number solutions, but it is brute force in that it’s exhaustively looking for “interesting” constructions.

Geometry was always my worst subject, but even so I felt like if given the right construction the problem was much easier. Unfortunately I never developed the intuition to hit on those constructions quickly. It seems this AI doesn’t either, but it can churn through them much faster — There are only so many perpendiculars and parallels and bisectors you can construct which you can more or less mechanically evaluate (map out all angles and ratios, try power of a point, etc.)

While this is incredibly impressive, it seems like Deep Mind:Kasparov::AlphaGeo:Terry Tao in the “engine vs AI” sense.

I agree Algebra is likely next. Like geometry, more often than not you “just” need a clever substitution or 3, of which there are only so many options to choose from.

Some combinatorics problems I think would also be amenable to this search strategy (e.g., finding things to count 2 ways), but that seems like a bridge further away, and only gets you a subset of problems.

Number theory would be my guess for the final frontier before a perfect 42.

fovc··on A simple, arena-backed, generic dynamic array for C
> On average they consume about twice the memory of a fixed array of the same size.

Not to split hairs, but that’s just the “unfreed” memory overhead.

If you have 2^n+1 elements, you’ve provisioned 2^(n+1) slots and leaked ~2^(n+1) on top, making the actual overhead there closer to 4x.

I think that means the average overhead is more like 3x (sometimes 4x, sometimes 2x).

fovc··on A simple, arena-backed, generic dynamic array for C
What’s the difference between this and other dynamic array implementations? I thought they were all data/length/capacity headers with exponential resizing.

I know when using realloc the old buffer is recycled unlike with this arena, but that seems like more of an arena vs. Malloc distinction, no?

In contrast the hash map discussion was more interesting to me because it’s a different data structure that’s explicitly arena friendly

fovc··on An easy-to-implement, arena-friendly hash map
Can’t edit now, but it should be initialized to lowerBits - (1 << (pageIndex + BASE_PAGE_BITS - 1)) for pageIndex > 0, or just lowerBits if pageIndex = 0.
fovc··on An easy-to-implement, arena-friendly hash map
Not much of a C programmer, but here’s my ChatGPT assisted (painstakingly…) attempt at a lookup function. I think the log2 from math.h needs to be rewritten to use a fast bitwise implementation

    #include <stdint.h>
    #include <math.h>
    #include <stdbool.h>

    #define BASE_PAGE_BITS 14
    #define MAX_PAGES 22

    struct KeyValue { keytype key; valtype val; bool inUse; };
    uint32_t hash(keytype key);
    int equals(keytype key1, keytype key2);

    struct HashTable {
        struct KeyValue pages[MAX_PAGES][];
        uint8_t usedPages;
    };
    typedef struct HashTable HashTable;

    struct KeyValue* lookup(HashTable* table, keytype key) {
        uint32_t hashed = hash(key);
        uint32_t lowerBits = hashed & ((1 << (BASE_PAGE_BITS + table->usedPages)) - 1);
        uint32_t pageIndex = (lowerBits == 0) ? 0 : (uint32_t)(log2(lowerBits >> BASE_PAGE_BITS) + 1);
        uint32_t entryIndex;
        
        for (;;) {
            uint32_t entryIndexRange = (pageIndex == 0) ? (1 << BASE_PAGE_BITS) : (1 << (pageIndex + BASE_PAGE_BITS - 1));
            
            for (; entryIndex < entryIndexRange; entryIndex++) {
                struct KeyValue* page = table->pages[pageIndex];
                if (!page[entryIndex].inUse) return &page[entryIndex];
                if (equals(page[entryIndex].key, key)) return &page[entryIndex];
            }
            
            pageIndex = (pageIndex + 1) % table->usedPages;
            entryIndex = 0;
        }
    }
fovc··on An easy-to-implement, arena-friendly hash map
IIRC, NRK started down this path because normal hash tables without free leak memory on every resize.

The original series of articles had me thinking about how to implement the normal hash table without leaking. I think it’s possible:

First consider a hash table using linear probing with a dedicated arena (restriction will be lifted later). That means memory can grow for free. However, resizing is still tricky because we need to rehash in place while ensuring we don’t “strand” any entries. This can be accomplished by iterating through the hash table entries in order, but starting at an empty entry and looping around. (Proof left as an exercise for the reader)

So now we have a hash table that can use realloc to grow. How to generalize for arenas? The key is that the HT will maintain a page map of sorts. The first page is of size M, the second is of size M, and thereafter they’ll be of size 2^n * M. Basically on each resize we double the total capacity by adding a new page. Since the pages are of variable width, though, how to map indexes to pages quickly? The key is to use ffs or ctz to get a rounded log2.

fovc··on Digression 3: Corrosion – Rust Never Sleeps
Would love some targeted RSS feeds if possible! Especially for the books
fovc··on The Tragedy of Google Search
I think you’re right on a narrow definition of price and quantity like what Wikipedia gives:

> A natural monopoly is a monopoly in an industry in which high infrastructural costs and other barriers to entry relative to the size of the market give the largest supplier in an industry, often the first supplier in a market, an overwhelming advantage over potential competitors. Specifically, an industry is a natural monopoly if the total cost of one firm, producing the total output, is lower than the total cost of two or more firms producing the entire production.

In theory pricing/output in economics is always “quality adjusted” (which is one of the hard things in inflation series)

Yes, traditionally a natural monopoly is one where if you split them, costs go up. With Google, GP is saying if you split them up quality goes down. Either way there’s “consumer harm”. (I guess very directly if the time to search goes up, the economic price of using Google goes up too)

fovc··on Digression 3: Corrosion – Rust Never Sleeps
Struggled a bit to find this, but here’s a link to the other chapters already written: https://books.worksinprogress.co/

Does anyone know if there’s an RSS feed?

fovc··on The Tragedy of Google Search
That’s called a natural monopoly which is a well studied phenomenon. Most commonly they are regulated as utilities with guaranteed low returns on capital and limited ability to set prices.
fovc··on The International SAT Competition Web Page
> Why do you backtrack when you hit a book?

Because I usually don’t own those books and don’t have a university library

> Often there are papers like '[topic] simplified' etc, and they can be quite useful.

Yes! This is adding heuristics on top of the basic algorithm, of which there are many useful ones. (Figure out who the field luminaries are, what the best journals/conferences were, etc.)

fovc··on The International SAT Competition Web Page
I guess “pun” because I proposed an exponential worst-case but usually actually fast algorithm based on backtracking, which is what SAT is.
fovc··on LAUSD to purchase 180 electric school buses
What’s happening to the old buses? $2M in savings on $75M in caped isn’t that great, unless the old buses were due for a refresh soon anyway
fovc··on The International SAT Competition Web Page
The general purpose algorithm that’s not necessarily the fastest but has an upper bound worst-case runtime:

1. Pick a paper in the field ~at random.

1b. If it’s basic enough for you, you’re done

2. Read the first few paragraphs and find the most basic statement that is cited

3. Find the cited paper

4. Go back to step 1b

Occasionally you’ll hit a book as the citation, in which case you must backtrack to take a different branch of the tree and try again.

In theory this is worst-case exponential, but in practice most searches end quickly

(Excuse the pun)

fovc··on File Attachments: Databases can now store files and images
We had this problem as well. For us a big part of the latency was just the bandwidth required for Postgres’s verbose text mode. It’s a shame there’s no way to compress the data on the wire
fovc··on Moonbit: Fast, compact and user friendly language for WebAssembly
I see from comments here that Moonbit has a GC. However, the resulting binary for Fibonacci is 253 bytes, which presumably does not include a GC. Is that using the proposed WASM-native GC, or is the build system smart enough to omit the GC since it’s not needed here?
fovc··on The Barbie-Oppenheimer Double Feature Is Happening, Data Shows
Wow, how did you get 12 people to commit for 5h simultaneously? Not facetious, genuinely curious. I don’t think I could do that even for a shorter birthday party
fovc··on National Geographic lays off its last remaining staff writers
Here to plug blendl again!
fovc··on Adversarial Collaboration Project
Phil Tetlock is there. Would love to see him and NN Taleb jointly publish on expertise!
fovc··on Show HN: Postgres query lock explainer
Ah thank you! Quoting the link for others;

> TRUNCATE is not MVCC-safe. After truncation, the table will appear empty to concurrent transactions, if they are using a snapshot taken before the truncation occurred. See Section 13.6 for more details.

> TRUNCATE is transaction-safe with respect to the data in the tables: the truncation will be safely rolled back if the surrounding transaction does not commit.

fovc··on Show HN: Postgres query lock explainer
It would be nice if you added a how it works section to the readme. Knowing that it does `begin; ${query}; rollback;` under the hood is important. The example with truncate in fact made me think the opposite was true, since truncate violates MVCC and cannot be rolled back.

I’m often worrying about locks in migrations that could be long running, so executing the query to figure out the locks defeats the purpose. Or at least I need to know to use a test DB.

fovc··on What if we tolerated diseases?
CMV is also strongly associated with pregnancy complications
fovc··on The part of Postgres we hate the most: Multi-version concurrency control
https://reorg.github.io/pg_repack/

Dead easy to run and no long-held locks

← PreviousPage 2 of 13Next →