HNHacker News
TopNewBestAskShowJobs

judofyr

6,773 karma · joined August 21, 2008

Programmer. judofyr@gmail.com @judofyr http://judofyr.net/
submissionscomments
judofyr··on Tiny Pointers
I didn't invest a lot of time in it because when these papers show no practical applications I always assume that the constant factors are too high. Especially when there's also no specific values of the constant factors presented. It's still somewhere back in my mind to implement it one day to figure out the nitty gritty details.
judofyr··on Tiny Pointers
The "compact dictionary" representation you're talking about not always using 64-bit numbers, but rather using log(n)-bit values when you have n entries (i.e. using 8-bit values when there's only <= 128 entries). The paper linked here talks about pointers which uses less than log(n)-bits for n entries.
judofyr··on Tiny Pointers
I looked a bit into this a few years back and found it quite interesting. Despite them calling them "Tiny Pointers" I would say it's closer to a open addressing hash map. You have a specific key, and then you can "allocate" an entry in the hash map. This gives you back a "pointer". You can then later use the original key and the pointer together to determine the index of the entry. There's also a slight chance that the allocation will fail (similar to a hash collision in a hash map). The "trick" here is that two different keys can end up having the exact same pointer (because we're always dereferencing with the key). This makes them more compact.

I was struggling a bit to come up with good use cases for it. Their examples are all around combining them with existing data structures and they show that the space complexity is smaller, but it wasn't completely clear to me how feasible this would actually be in practice.

judofyr··on Have Gemini stage and write commit messages for you
I’d rather have «wip» commit messages, and thus forced to open the diff, than worrying of the message being hallucinated.

I’m totally cool with people using this as an initial draft and then manually tweaking it though.

judofyr··on Ropey – A UTF8 text rope for manipulating and editing large text
> The standard library is full of unsafe code.

Yes, and this means that for me to trust that the code is memory safe I need to trust the people who develop the standard library (or validate the unsafe usage myself). Rust has a good track record and a very good review process to ensure correctness of their "unsafe" block.

This library however? Do they know how to write "unsafe" blocks? I don't know! Maybe? If there were zero uses of "unsafe" in this library I would be able to adopt it without worrying about memory safety at all. In addition, I'm not that good at knowing whether an "unsafe" block is safe myself. It's not like I can review this cases myself and be confident.

(Memory safety is of course not everything, but bugs related to memory safety are much more annoying than other types of bugs.)

judofyr··on HTML_slice: Enable Ruby classes the ability to generate reusable pieces of HTML
I've written a similar library and I can heavily recommend the approach: https://github.com/judofyr/tubby. The main difference between this and the other approaches (HTML_slice, Phlex) is that Tubby doesn't depend on inheritance or module inclusion. This means that it's slightly more verbose (you need to add "t." to each tag), but there's never any confusion of what `self` is nor any method collision. (For instance, looking at HTML_slice it appears that if you class defines the instance variable "@html_slice" weird things will happen.)

If you have a server-side rendered Ruby application with complicated view logic I can 100% recommend this approach (either Tubby, HTML_slice or Phlex). It's a super powerful way of structuring logic. You can create standalone classes which represents concepts (e.g. I've created a "ResourceCalendar" which renders a calendar view showing which resources are available for a given day), add methods which act on these, and finally make them renderable. It's heavily composable. It's very similar to React components, but here you also have the power of defining separate methods instead of having everything be hooks (with weird limitations) at the top of the component.

I also wrote a longer article here describing the different types of components you can build using Tubby: https://github.com/judofyr/timeless/blob/master/posts/compos.... I think this would also apply to HTML_slice and Phlex.

judofyr··on Chess grandmaster Magnus Carlsen rejoins tournament he quit over wearing jeans
I’ve been following this over the years and while I’m a bit tired of it to address your other points directly, let me at the very least say that while he’s clearly very emotional and not always reacting in the most productive way, there’s typically a somewhat sensible reason behind it. He’s not a complete crybaby. He clearly cares a lot about the game, and he’s met a lot of unnecessary resistance.

But yea, he’s been acting far from perfect the last few years.

judofyr··on Chess grandmaster Magnus Carlsen rejoins tournament he quit over wearing jeans
> “I am playing at least one more day here in New York and, if I do well, another day after that,” Really?

This is taken a bit out of context. Day 1 is a qualification phase. Only the top 8 after that ends up playing on day 2. Saying «I will play two more days» would be more arrogant since it would imply he thinks he would easily be top 8.

EDIT: It could however be considered a subtle criticism of the format. Previously there were two days with 10-11 games per day. With the new qualification system you’re suddenly more dependent on having a good first day. Many players have expressed that they thought it was more fair to have more games over two days.

judofyr··on Carlsen quits World Rapid and Blitz championship after dress code disagreement
The principle here isn’t about the dress code per se (Carlsen hasn’t made much fuss about it earlier[1]), but the fact that a minor mistake on his part (he chose the wrong pants) is being punished severely. What would would be wrong with giving him a $200 fine and warning him he would be disqualified if he didn’t abide by it next day? Why is it so important to change immediately when you’re still very much dressed acceptable? Stressing about your clothing is not what you want to do when you’re focused on making a come back.

The reason is (according to Carlsen) of course that FIDE is driven by a strict adherence of «rules» which are defined by a small set of people in power. Whenever something happens they always say «oh, but these are the rules», but the process for changing the rules is very one-sided and power driven. This was the straw that broke the camel’s back. Yet another example of a silly unnecessary rule.

[1]: In an earlier WC he got stuck in traffic and arrived in ski clothing, but changed after the first round.

judofyr··on Gukesh becomes the youngest chess world champion in history
Many different reasons:

1. The biggest one is probably that there is already so much interest and depth in regular chess. "Everyone" focuses on it, so that's what your friends know and where you can find competitions and community. This leads to a chicken-egg problem where it hard to kick it off. It's basically like another board game.

2. Some opening positions in Fischer chess are quite awkward: The pieces are on squares where it takes a while for them to come into proper play. This can make the opening phase quite unsatisfying to play. You need to make a lot of extra moves before you actually get into the interesting parts. It's not necessarily more "fun" to play this way than regular chess. There's also some positions which are much better for white (although it's on average more balanced I believe)

3. IMO, regular chess is easier for lower-rated players. The choice of openings don't matter so much (either way the game is decided by someone hanging a piece), and it's a lot easier to follow existing games. In Fischer chess it can be even harder to know "okay, what do I do?", while in regular chess there's both general principles and systems to follow. This means that most newer players keep being exposed to regular chess instead of Fischer chess.

> Wouldn't Fischer chess take the game to a whole new level, making it so that all the opening books are useless and the midgame requires much more improv?

Magnus Carlsen is promoting and advocating for Freestyle Chess (same game as Fischer chess, but with different name): https://www.freestyle-chess.com/. Maybe it'll take off.

judofyr··on Weak pointers in Go: why they matter now
Please elaborate! What's your definition? I was struggling a bit to phrase it precisely. My main point was to distinguish between "well-defined panic" (which is just like any other panic) and "silent memory corruption which keeps the program running".

To me it seems rather arbitrary that appending to a slice concurrently in two different goroutines causes the garbage collector's sweep-phase to internally think another allocation has occurred.

judofyr··on Weak pointers in Go: why they matter now
Go without concurrency is fully memory safe. However, once you start using goroutines there can be memory corruption and segfaults: https://github.com/golang/go/issues/37484. Note that these are not recoverable panics (such as "writing to a close channel"), but causes completely arbitrary behavior:

    runtime: pointer 0xc00379ac60 to unused region of span span.base()=0xc001794000 span.limit=0xc001795e00 span.state=1
    fatal error: found bad pointer in Go heap (incorrect use of unsafe or cgo?)

    runtime: nelems=8 nalloc=5 previous allocCount=4 nfreed=65535
    fatal error: sweep increased allocation count
judofyr··on 1/0 = 0 (2018)
The arguments around limits are addressed towards the end (under "Update 8/12/2018"):

> > If 0/0 = 0 then lim_(x -> 0) sin(x) / x = sin(0) / 0 = 0, but by L’Hospitals’ Rule lim_(x -> 0) sin(x) / x = lim_(x -> 0) cos(x) / 1 = 1. So we have 0 = 1.

> This was a really clever one. The issue is that the counterargument assumes that if the limit exists and f(0) is defined, then lim_(x -> 0) f(x) = f(0). This isn’t always true: take a continuous function and add a point discontinuity. The limit of sin(x) / x is not sin(0) / 0, because sin(x) / x is discontinuous at 0. For the unextended division it’s because sin(0) / 0 is undefined, while for our extended division it’s a point discontinuity. Funnily enough if we instead picked x/0 = 1 then sin(x) / x would be continuous everywhere.

Similar examples can be constructed for any regular function which is discontinuous (e.g. Heaviside step function).

judofyr··on You can use C-Reduce for any language
I actually tried to Shrinkray it myself, but after ~3 minutes it crashed with the following stack trace:

      (4 nested BaseExceptionGroup: Exceptions from Trio nursery (1 sub-exception), and then:
      +-+---------------- 1 ----------------
        | Traceback (most recent call last):
        |   File "/nix/store/5cdw4sa0n0lwym47rd99a1q6b4dj7nr9-python3.12-shrinkray-0.0.0/lib/python3.12/site-packages/shrinkray/work.py", line 221, in parallel_map
        |     yield receive_out_values
        |   File "/nix/store/5cdw4sa0n0lwym47rd99a1q6b4dj7nr9-python3.12-shrinkray-0.0.0/lib/python3.12/site-packages/shrinkray/work.py", line 71, in map
        |     yield v
        | GeneratorExit
        +------------------------------------
Not sure if this is a known issue? Note that I ended up not respecting all of the version requirements in the pyproject.toml since I tried to run it all in Nix and there the Poetry support is currently quite lacking.
judofyr··on You can use C-Reduce for any language
Oh, that’s a neat idea. To reply to the sibling comment: Nix runs commands under a sandbox. It’s not bullet proof, but useful enough that it will prevent obvious commands like deleting local files and accessing the network.

It took some time to get RustPython to run, but it seems to work fine: https://gist.github.com/judofyr/82d2255c92ebb0c6b3a6882ac9fd...

Also, after running it for 5 minutes it was now able of reducing it to a much smaller case:

    class a:
        def b() : c
        def h(d) :
            while d:
                    break
            else:
                return 
            d.b()
    def j(e) :
        f = a()
        if f.h  () :
                g
    i = ""
    j(i)
judofyr··on You can use C-Reduce for any language
Well, aren't you going to share the reduced file?

Okay fine, let's see for ourselves:

    # Setup
    git clone git@github.com:RustPython/RustPython.git && cd RustPython && cargo build --release
    git clone git@github.com:tekknolagi/scrapscript.git && cp scrapscript/scrapscript.py .

    # Download interesting.sh, replace the path to RustPython
    chmod +x interesting.sh

    # Command in article:
    nix run nixpkgs#creduce -- --not-c interesting.sh scrapscript.py

Niiice:

    (93.2 %, 13717 bytes)
    (93.2 %, 13683 bytes)
    (93.3 %, 13614 bytes)
    (93.3 %, 13592 bytes)
    (93.3 %, 13571 bytes)
    (93.3 %, 13517 bytes)
    (93.3 %, 13449 bytes)
    (93.4 %, 13412 bytes)
    (93.4 %, 13365 bytes)
    (93.4 %, 13333 bytes)
    (93.4 %, 13313 bytes)

It seems to have stopped at "(96.4 %, 7347 bytes)" with the following output: https://gist.github.com/judofyr/47cba8a20cb2cd5798943ef975d0...
judofyr··on Regular Expressions which query an Oracle
> OTOH, these expressions do not generate a regular language.

Okay sure you're technically correct here, but only because these expressions generate a subset of a regular language. The LLM can only be invoked on a substring that can expressed as a regular expression, and then it's only used to remove strings from the language. Their results are based heavily on how regular expressions work. A "semantic context-free grammar" would have different type of characteristics and behavior.

Maybe throwing in the word "extended" or "augmented" would be a bit more clear, but as I reader I definitely would expect "regular expression" to be part of the name.

judofyr··on Regular Expressions which query an Oracle
Your rant is a bit unfounded for this paper as they do actually take completely standard regular expressions (no backtracking or anything like that) and extend it with one more construct. Calling it «semantic regular expressions» seems perfectly reasonable to me. What else to call it?

As for outside of the computer science sphere (which I find is quite consistent in their terminology): I do agree that it seems like it’s a lost cause and «regex» is now synonymous for «pattern matching using this one specific syntax» :(

judofyr··on Cybertruck's Many Recalls
The word bug sort of implies that the device was struck by a terrestrial arthropod animal. Calling a software defect that happens due to a programming error a "bug" definitely is worthy of quotes.

(The etymology of a word can be quite different from its current meaning today.)

judofyr··on The two factions of C++
https://www.typescriptlang.org/tsconfig/#isolatedModules
judofyr··on The Median Researcher Problem
> It’s exactly the sort of community which can potentially outperform whole large fields, because of the median researcher problem. On the other hand, that does not mean that those fields are going to recognize LessWrong as a thought-leader or whatever.

Oooooh, now I see what's going on here. The good ol' "the reason no one listens to us because we're too smart for them".

Unfortunately, the fact that some smart people was ignored by their peers doesn't mean that "being ignored" suddenly becomes evidence for your thoughts being "beyond the median". It could also be that it's just not that groundbreaking.

(Disclaimer: I've only read a few LessWrong articles over years and I don't have that strong opinion of their community. Mostly basing this comment on just this post.)

judofyr··on Show HN: Whirlwind – Async concurrent hashmap for Rust
Very fascinating results though! The sharding approach is quite a simple way of doing more fine-grained locking, making sure that writes don't block all the reads. Pretty cool to see that it actually pays off even with the overhead of Tokie scheduling everything!

There might be some fairness concerns here? Since we're polling the lock (instead of adding ourselves to a queue) it could be the case that some requests are constantly "too late" to acquire it? Could be interesting to see the min/max/median/P99 of the requests themselves. It seems that Bustle only reports the average latency[1] which honestly doesn't tell us much more than the throughputs.

[1]: https://docs.rs/bustle/latest/bustle/struct.Measurement.html

judofyr··on Show HN: Whirlwind – Async concurrent hashmap for Rust
One thing which wasn’t obvious to me from the benchmark: What’s the key distribution? A sharded map will probably have great performance on uniform keys, but in my experience it’s far more common to have power law distribution in real life scenarios.

It would be good to see a benchmark where it only touches a _single_ key. If Whirlwind is still fast than the others I would be far more convinced to use it unconditionally.

EDIT: I also see that you're benchmarking on a M3 Max. Note that this has 6 performance cores and 6 efficiency cores. This means that if you're running at <6 cores it will most likely start out running it at the efficiency core. From my experience it's quite important to do warmup phases in order to get stable results at low thread count. And even then I find it hard to reason about the results since you're running in mixed set of cores…

judofyr··on Apple Intelligence is available today on iPhone, iPad, and Mac
From the article (emphasis mine):

> Private Cloud Compute hardware security starts at manufacturing, where we inventory and perform high-resolution imaging of the components of the PCC node before each server is sealed and its tamper switch is activated. When they arrive in the data center, we perform extensive revalidation before the servers are allowed to be provisioned for PCC. The process involves multiple Apple teams that cross-check data from independent sources, and the process is further monitored by a third-party observer not affiliated with Apple. At the end, a certificate is issued for keys rooted in the Secure Enclave UID for each PCC node. The user’s device will not send data to any PCC nodes if it cannot validate their certificates.

judofyr··on NixOS is a good server OS, except when it isn't
What did you replace it with? I've been been using NixOS for a (non-critical) server which replaces another server that was "managed" by Ansible. Now that's it running nicely on NixOS, and while it's far from perfect, I'm really struggling to see how I would manage it in any other way. The experience is so much nicer now.
judofyr··on Amusing Ourselves to Death (2014)
> And everyone should note this is the television of the 1980s. You still don't really have home recording, there are a limited number of channels, and the monoculture truly exists.

This is a good point as well! When reading it I was reflecting on how internet compares to 1980s television. Yes, it has much more dopamine-fueled content, but it's way less of a monoculture. It gives a lot of opportunity for people to seek out what they're interested in and there's hundreds (thousands?) of communities with very different set of thoughts.

judofyr··on Amusing Ourselves to Death (2014)
> Thinly veiled 'I despise stupid people', this one.

Are you talking about this comic (i.e. a few sentences from the book) or the whole book?

I read the book a few years back and it's entirely focused on culture as a whole and less about the individual choices. He's not making a point of "television makes you dumb" (or "dumb people watches television"), but rather he makes the distinction between an "oral"-, "press"- and "television"-based culture. He claims that it's bad when television becomes the main platform that a society centers its communication around.

He's also honest that there's probably far more junk (in absolute terms) in printing than in television: "Television is not old enough to have matched printing's output of junk." It's not about the amount of "junk" – it's about something more fundamental about the medium.

I found the book quite interesting and would highly recommend reading it!

> They'd be boozing (more than they already are) if there wasn't such variety of cheap and available entertainment, the author doesn't seem to realize?

That's an extremely pessimistic view of the world: Categorizing a set of human beings as "stupid" and saying that it doesn't matter how society is structured?

And "smart people" are also influenced by how our society is structured, no?

judofyr··on Collaborative text editing with Eg-Walker: Better, faster, smaller
Let me see if I understand this correctly:

CRDTs take an editor event such as "insert at position X" and turns it into something a concrete operation like "insert to the right of node Y created by client C" which is then sent. This makes it super easy to apply concurrent operations since they have a direct reference to where they're located. However, it also means that you know have to keep track of these nodes. All of the nodes that has ever existed is present at all times, and deletion is handled as a state flag which marks it as hidden.

OTs take an editor event such as "insert at position X" and keeps it like that. Whenever a concurrent event is received it then tries to "rebase" it (i.e. patch that event) so that it makes sense on top of the current events. However, this (1) can be quite finicky to get right and (2) it is based on there being One True Order of Events (i.e. a server).

This approach takes an editor event such as "insert at position X" and keeps it like that. When applied, it can be inserted into an "ever-growing list of atoms with state flag". However, in this algorithm the data structure is actually capable of representing two different versions at the same time: A current version and a final version. This is handled by there being two state flags instead of one: Every node has a "current state = exists/deleted" and "final state = exists/deleted".

This gives us the power of doing a "soft undo" (which is called "retreat" in the paper): We can take our own latest event which we've applied, revert the effect on the current version, while still keeping the final version the same. We're handling this very similar to CRDTs: We keep all the nodes at all time, we're just using state flags to keep track of whether it exists or not.

This is useful when we observe a concurrent event. This event have references to positions which are valid in the context of its parent. If we "retreat" of all of our events until we reach the parent, we then have a data structure which represents the text at that point. We can now apply the "insert at position Y"-events which we received by interpreting "Y" in terms of the current version. After we've applied all of those events we can then look at the final version and this now actually contains the combined result of both changes!

And here comes the nice part: Since the events themselves are always on the form "insert at position X" it means that we can choose another representation of applying them. For instance, if we know that there are no concurrent events that are happening, we might as well apply them directly on a string without bothering with the whole "current/final dual data structure".

judofyr··on Show HN: Httpdbg – A tool to trace the HTTP requests sent by your Python code
Looks neat!

A similar tool for this would be VCR (originally built in Ruby, but ported to other languages since): https://vcrpy.readthedocs.io/en/latest/. This injects itself into the request pipeline, records the result in a local file which can then also be replayed later in tests. It's a quite nice approach when you want to write tests (or just explore) a highly complicated HTTP API without actually hitting it all the time.

judofyr··on Show HN: Chili. Rust port of Spice, a low-overhead parallelization library
The README of Spice has detailed explanation of the approach: https://github.com/judofyr/spice
← PreviousPage 3 of 32Next →