HNHacker News
TopNewBestAskShowJobs

thomasmg

654 karma · joined June 19, 2018

Original author of Hypersonic SQL and H2 database (Java relational databases): h2database.com
submissionscomments
thomasmg··on Notes by djb on using Fil-C
The author of Fil-C does have some ideas to avoid a garbage collector [1], in summary: Use-after-free at worst means you might see an object of the same size, but you can not corrupt data structures (no pointer / integer confusion). This would be more secure than standard C, but less secure than Fil-C with GC.

[1] https://x.com/filpizlo/status/1917410045320650839

thomasmg··on Notes by djb on using Fil-C
I agree. The main advantage of Fil-C is compatibility with C, in a secure way. The disadvantages are speed, and garbage collection. (Even thought, I read that garbage collection might not be needed in some cases; I would be very interested in knowing more details).

For new code, I would not use Fil-C. For kernel and low-level tools, other languages seem better. Right now, Rust is the only popular language in this space that doesn't have these disadvantages. But in my view, Rust also has issues, specially the borrow checker, and code verbosity. Maybe in the future there will be a language that resolves these issues as well (as a hobby, I'm trying to build such a language). But right now, Rust seems to be the best choice for the kernel (for code that needs to be fast and secure).

thomasmg··on Austria: Pylons as sculpture for public acceptance of expanding electrification
> The stag is cool

Yes.

There is some psychological advantage. These ideas might make the overland options more acceptable for the population.

Switzerland and other countries have nice looking (and sometimes expensive) sculptures in traffic roundabouts. For transmission lines, it might make sense, even if it is more expensive. Sure, it depends on the price. But it is much, much cheaper than burring the cables: underground transmission lines are roughly 10 times more expensive, due to cooling mainly (and sometimes this would require converting to DC). So there are three options: traditional (cheapest), such designs (more expensive), or hidden (10 times the price of traditional).

thomasmg··on Fil-C: A memory-safe C implementation
Go programs are not fully memory-safe if they use multiple treads, due to possible data races with fat pointers: https://news.ycombinator.com/item?id=44672003
thomasmg··on Clean hydrogen at a crossroads: Why methane pyrolysis deserves attention
The problem with electrolysis is the high capital cost. As long as / where the price of electricity near zero only some of the time, it is too expensive. (With batteries and more photovoltaics this might change a bit.)
thomasmg··on Quicksort explained IKEA-style
I agree, IKEA instructions are great. A bit related are railroad diagrams, like the one of the JSON syntax [2].

I worked on Rubik's cube solving instructions for beginners [1] (for my children initially), but then I found it would be so much better if the instructions are IKEA style. (Then I vibe-coded a Rubik's cube 2D and 3D model, and now I stopped working on this. Something for later.) For the cube, I want to implement the algorithm, and then from the program create IKEA instruction (or a mix of IKEA and railroad diagram). That way I can be sure I didn't skip any steps in the instructions.

[1] https://github.com/thomasmueller/rubiks/blob/main/README.md

[2] https://www.json.org/json-en.html

thomasmg··on New thermoelectric cooling breakthrough nearly doubles efficiency
Air conditioning is mostly needed while the sun is shining, and so electricity of A/C can come mostly from photovoltaics (plus batteries). So I think this technology is not quite as important. Sure, its nice to reduce electricity usage! But cheaper heat storage, for winter, seems more important.
thomasmg··on The bloat of edge-case first libraries
Many libraries throw an exception, panic, or silently swap the parameters at runtime.

To detect this at compile time, you would need either min and max to be known at compile time, or a type system that supports value-dependent types. None of the popular language support this. (My language named 'Bau', which is not popular of course, support value-dependent types to avoid array-bound checks.)

thomasmg··on The LLM Lobotomy?
LLM are just software + data and can be made deterministic, in the same way a pseudo random number generator can be made deterministic by using the same seed. For an LLM, you typically set temperature to 0, or set the random seed to the same value, run it on the same hardware (or emulation) or otherwise ensure the (floating point) calculations get the exact same results. I think that's it. In reality, yes it's not that easy, but it's possible.
thomasmg··on The Fisherman and His Wife (1857)
It depends on the religion. In Christianity, Islam, and some "the universe is a simulation" theories: yes. In other religions, god is not all that powerful.
thomasmg··on The Fisherman and His Wife (1857)
My interpretation is that the fish didn't actually turn down and punish, but fulfilled the wish. It's just that the fish thought: to be like God means to be humble. She asks to be like God, true godliness is humility. So she did get what she wanted, but not in the way she thought. (BTW I'm not religious in the sense I go to church a lot, and don't even necessarily believe in God, but I do share many of the values of religion.)
thomasmg··on Luau – Fast, small, safe, gradually typed scripting language derived from Lua
I fully agree. Lua and Luau are impressive, sure, but they are not really "small" or "simple", in my view. I don't think the complexity is unavoidable however. There are many programming languages that are much simpler, but at the same time very expressive. I'm working on one of them currently named "Bau" [1], and I started working on a Lua-inspired VM [2] for a subset of this language. There are many languages like mine, most of them incomplete and not really popular, discussed in [3].

[1] https://github.com/thomasmueller/bau-lang [2] https://github.com/thomasmueller/bau-lang/blob/main/src/test... [3] https://www.reddit.com/r/ProgrammingLanguages/

thomasmg··on Europe is locking itself in to US LNG
I would not describe this as "US and Russia are working together to fix the pipeline", but more like "some people think about it".
thomasmg··on EPA Seeks to Eliminate Critical PFAS Drinking Water Protections
Right. My fear is that the rules of the elections will be significantly changed as well soon, by this party.
thomasmg··on Fil's Unbelievable Garbage Collector
> there are as many newly available address ranges as dead objects

Well, when using a bitmap (as they seem to do in the article), then multiple subsequent dead objects are considered to be in the same range, because multiple subsequent bits in the bitmap have the value zero. There is no need to visit each zero bit in the bitmap separately.

thomasmg··on Fil's Unbelievable Garbage Collector
OK, I did not read the source code of the FUGC, but the article mentions "FUGC relies on a sweeping algorithm based on bitvector SIMD." So, assuming there is just one bit per block of memory, then there is no need to visit the memory of the dead objects in the sweep phase. The bit of the dead object is zero, and so that memory block is considered free and available for reallocation. There is no need to visit the free block.
thomasmg··on Fil's Unbelievable Garbage Collector
If you want to use a standard malloc / free implementation (dlmalloc etc.) then dead object need to be known, yes.

But the malloc library could be fully integrated into the GC mechanism. In this case, there is no need. That's probably much easier, and faster, because the malloc can be simplified to bumping a pointer.

thomasmg··on Inverting the Xorshift128 random number generator
I agree, why would you slow down things for everybody if it's only a problem for cryptographic purposes. Xorshift128+ etc are around 10 to 30 times faster than ChaCha20.

The challenge is things that don't _obviously_ need cryptographically secure generators. For example, do you need a secure generator for the seed of a hash table, or a sorting algorithm? (For those that do use a seed). Some will argue that yes, this is important. Until a few years ago, the hash tables used static hash algorithms without any randomization, but "hash flooding" changed that. I think that nowadays, still many hash table implementations don't use secure generators.

Then, there's secure and insecure hash functions. Secure hash functions like SHA-256 are (compared to non-secure functions) specially slow for short keys. There are "somewhat" secure hash function algorithms like SipHash that can be used for this purpose.

thomasmg··on A review of Nim 2: The good and bad with example code
Which compile options do you recommend for best performance, but such that it is still memory-save? (I assume you use memory-save, right?) Currently I use "nim c --opt:speed". Compared to other languages (Go, Rust mostly) the runtime performance (for my use cases) is a bit slower, for some of the cases. Hm, it might be that you disable memory safety, if you compare against C++...
thomasmg··on 15-Fold increase in solar thermoelectric generator performance
> Current gen nuclear designs are basically meltdown proof

Basically.

thomasmg··on 15-Fold increase in solar thermoelectric generator performance
The liability is capped at a certain amount. In the US, that is around $450 million per reactor. They also have to buy in to a fond. In France, the cap is 700 million euro. Above that, the federal government _could_ step in. The problem is, no private insurer (or even pool of insurers) could cover the absolute worst-case GAU, and not even the government really.

In Fukushima, TEPCO was required pay $1.5 billion. But the real cost is / was around $150 billion. So, the bulk of the disaster was not covered / covered by the taxpayer. So: the public.

thomasmg··on 15-Fold increase in solar thermoelectric generator performance
If you remove environmental regulations, then (pumped) hydro, wind, and photovoltaics would also be much cheaper, and much faster to build. For windmills, it's birds and whatnot, for photovoltaics (specially large-scale in the mounts) it's wildlife and other environmental impact.
thomasmg··on 15-Fold increase in solar thermoelectric generator performance
In the next years, it doesn't make sense to use batteries to sustain winter load: it would be way too expensive. But batteries get cheaper quickly, such that it doesn't make sense to build expensive nuclear plants just for winter. What does make sense, until batteries are cheap enough, is natural gas during winter, plus (where available) wind energy and hydro / pumped storage, existing nuclear plants (optimised for winter), biomass (wood), photovoltaics in the mountain, and geothermal.
thomasmg··on 15-Fold increase in solar thermoelectric generator performance
Wind turbines can, and are, turned off (by turning, feathering the blades, and braking). There are two main cases: high wind / storm, and too much electricity in the grid. Photovoltaics can also be turned off.

The main reason for negative electricity prices are inflexible generators, eg. nuclear and coal, because they can't easily (cheaply) ramp down or shut off. Sometimes it is cheaper to let prices go negative than to use emergency mechanisms (that do exist).

Negative prices are not all bad: they are an incentive for storage / flexible demand to step in. Specially, a negative price does not mean the grid is melting.

thomasmg··on 15-Fold increase in solar thermoelectric generator performance
Nuclear also have weather failures: low water levels, and high river temperature. In both cases the power plant needs to reduce output or be turned off.
thomasmg··on 15-Fold increase in solar thermoelectric generator performance
Nuclear costs would be way higher if the plant operators would need to have insurance for catastrophic failures. Right now, they don't need that. The state (the population) just takes this risk.
thomasmg··on 15-Fold increase in solar thermoelectric generator performance
No, you just turn off some windmills.
thomasmg··on 15-Fold increase in solar thermoelectric generator performance
Wind + solar + batteries.

Nuclear has its own failure modes. In Switzerland, one of the nuclear plants will be offline for winter (!) due to "unplanned repairs". This will cost the owners of the plant millions.

thomasmg··on Group Borrowing: Zero-cost memory safety with fewer restrictions
> In Rust you can hold references directly into the buffer backing the array

Yes! But I am arguing that this prevents having multiple mutable references

> My Java knowledge is quite rusty > Also because Java is a GC'ed VM ...

Your Java knowledge is fine :-) But I'm arguing that you don't strictly need a GC'ed, or RC'ed language: if done "correctly", multiple mutable references are possible. Just not with fat pointers! The programming language I'm building allows this even today. You can try it in the playground [1]:

    fun main()
        list := List+(int[4]) # <<= owned list
        borrow : &list        # <<= mutable borrow
        for i := until(4)
            borrow.add(i)
            list.add(10 * i)
        for i := until(8)
            println(borrow.array[i])
    
    type List
        array int[]
        size int
    
    fun List+ add(x int)
        if size >= array.len
            n : int[array.len * 2]
            for i := until(array.len)
                n[i] = array[i]
            array = n
        array[size] = x
        size += 1
So "List+" is owned type (just "List" without "+" would be reference counted). You may want to look at the generated C code at the end of the page.

[1]: https://thomasmueller.github.io/bau-lang/

thomasmg··on Group Borrowing: Zero-cost memory safety with fewer restrictions
In Rust, a vector is a "fat pointer" (with pointer to the array and length / capacity) which lives on the stack. In Java, the pointer to the array and length / capacity lives in the heap. So in Java, there is an indirection, and it is allowed to have multiple pointers to the ArrayList object.

> A language without realloc sounds painful. Any growing container would lead to stale data.

I think it's not so much about realloc, but about whether it's a fat pointer or not. (I could imagine that Java uses something like realloc for the array, if there is only one pointer to the array for sure).

Fat pointers have some advantages and some disadvantages. Rust chose fat pointers, I assume for performance reasons. That's fine. Java doesn't. But I don't think that's a _huge_ performance disadvantage for Java. What I'm arguing is not so much that one is better and the other is worse, just that there are advantages and disadvantages. Rust might be slightly faster, but a language without (this kind of) fat pointers could potentially be easier to use.

← PreviousPage 4 of 10Next →