Better HN
topnewbestaskshowjobs
Log inSign up

sapiogram

922 karma · joined Aug 18, 2014 (12y ago) · 345 submissions

Submissions

comment 2y ago · link · parent

Is there a writeup somewhere by someone with a slightly stronger command of English?

comment 2y ago · link · parent

https://youtu.be/THJP_HB5HEk?si=gmdl6vIBVREc5rpA

Link for the lazy

comment 2y ago · link · parent

Focus on laying out all the pieces, such that there are no dead ends. There's very few ways to do that, afterwards you can quickly brute-force the rest.

The winning move might be to not play, tbh. It was by far my least favorite level.

comment 2y ago · link · parent

Can someone just provide me the solution to #3? I literally cannot figure it out.

comment 2y ago · link · parent

> I’ve been writing Go for a while but never really thought about it.

Don't feel bad, I've tried to do this in some places, but I'm not sure it's worth it. It adds a ton of boilerplate to Go's already verbose error handling, since you need to wrap every error that gets returned from libraries.

comment 2y ago · link · parent

His method was fundamentally sound though. He realized that moonlight is reflected sunlight, and that if you observe the angle between the sun and the moon in the sky at exactly half moon, you can calculate the distance to the sun relative to the distance to the moon.

comment 2y ago · link · parent

Removing the GIL requires more locking/unlocking operations. For single-threaded program, it's a performance penalty on average: https://peps.python.org/pep-0703/#performance

comment 2y ago · link · parent

Housing isn't bitcoin, it's possible to make more of it. And that's the point: Rent control often ends up disincentivizes construction, making it worse for tenants in the long run.

comment 2y ago · link · parent

I only took a brief look, but from an API perspective, this seems identical to "normal" garbage collectors? In the sense that from the programmer's perspective, all the allocations live forever?

comment 2y ago · link · parent

> The fact that the author calls it a slab arena makes me think they did, indeed, intend for it to be used with a single type per arena.

Maybe? But that seems strange, since they seem to have intended it to be used for http servers making per-request allocations.

Come to think of it, the arena is probably still unsound with just ints, because the underlying allocation is just for a `[]byte`, which I don't think is guaranteed to be aligned to 8 bytes. Might be on most platforms, though.

comment 2y ago · link · parent

> I might be a bit ignorant here, but I was under the impression that this is what every program already does.

It is not. Arena allocators have a fundamentally different API, because they don't allow you to de-allocate individual objects in the arena - everything must be de-allocated at once. For specific workloads, like repeatedly allocating a large number of short-lived objects, this can be a huge speedup, and also significantly reduce memory usage.

comment 2y ago · link · parent

Looks like the arena is completely unsound if you mix types with different alignments?

  arena := NewSlabArena(8182, 1) // 8KB

  var b *byte = New[byte](arena)
  var i *int = New[int](arena)

  fmt.Printf("Pointer address: %p\n", b)
  fmt.Printf("Pointer address: %p\n", i)
Result:

  Pointer address: 0x14000198000
  Pointer address: 0x14000198001
I'm not a Go language lawyer, but I assume this is just immediate UB. OP, it's fine to publish a library without experience in manual memory management, but maybe put a disclaimer in the README?

comment 2y ago · link · parent

She has a PhD in astrophysics, with her academic work centered around the co-evolution of supermassive black holes and their host galaxies. As far as I can tell, she's still an active researcher, even though she clearly spends a lot of her time on her Youtube channel.

comment 2y ago · link · parent

A rising tide lifts all boats. Maybe "most valuable tech company in the world" would be a more convincing argument, since the tide receded shortly afterwards.

comment 2y ago · link · parent

There just isn't enough memory bandwidth. Afaik dual-channel DDR5 still can't hit 100GB/s? Meanwhile the $270 RX 7600 has 288GB/s on-board memory.

comment 2y ago · link · parent

You also have to know whether it's `cd cmd; go run main.go` or just `go run cmd/main.go`. And you have to know to set CGO_ENABLED=0 if you want to run it on Linux instead of MacOS.

comment 2y ago · link · parent

> Level 2 - memory safe and data races allowed

> Languages where parallelism is memory safe, but can still lead to data races.

> This includes Java and Go.

Despite this common misconception, parallel Go is absolutely not memory safe: https://blog.stalkr.net/2015/04/golang-data-races-to-break-m...

comment 2y ago · link · parent

> So there is some plan :)

How does that follow from the rest of your comment?

comment 2y ago · link · parent

> I read that each image generated might produce the same amount of carbon as driving four miles

I can safely assure you that this is bullshit. Any electric car will use well over 1 Kwh to travel that distance. You can run two high-end GPUs for an hour with that amount of electricity. You're not spending two hours of GPU-time to generate your images.

comment 2y ago · link · parent

Can this also generate "universal" balancers? I've found them more useful in practice: https://wiki.factorio.com/Balancer_mechanics#Universal_balan...

comment 2y ago · link · parent

> The critique of induced demand is pretty much centered on the fact that urban sprawl is widely considered as bad, which the author does not seem to even acknowledge.

Isn't this exactly what the author's point #2 ("More and better infrastructure lets us spread out and enjoy more space") was about?

comment 2y ago · link · parent

I'm not sure how important the difference is in practice, offshore oil drilling sounds like something that can be easily disrupted during a war.

comment 2y ago · link · parent

In terms of military strategy, your argument might make sense, but it's unsound from a purely economic perspective. Norway's solution is far better: Drill the oil now, export it, and invest the money abroad. From the perspective of the domestic economy, the result is mostly the same, but now the money multiplies abroad, and is far more easily available when it's needed.

comment 2y ago · link · parent

It does. Not exactly surprising, since Rob Pike and Ken Thompson made both Golang and UTf-8.

comment 2y ago · link · parent

> According to some benchmarks I've seen (sorry no link), a system call in the middle of a memory heavy inner loop can impact performance for 100 us before performance is back to steady state. This is 100x longer than the system call alone.

Do you some intuition of what causes this? I don't have how much experience with this kind of work, but 100µs is enough time to do hundreds of random memory accesses. How can a single syscall do so much damage to the cache?

comment 2y ago · link · parent

No scrolling with the scroll wheel though :(

comment 2y ago · link · parent

Go's "red" is also "function may return an error"

comment 2y ago · link · parent

> To me control flow is "if", "switch", "?:", etc. What article describes are abstractions.

Thank you for articulating this, I also don't understand why the author puts operator overloading in the same bucket as exceptions and `defer()`. Yes, `+` might call a function, but it will never affect the control flow of the parent function. Not more than a regular function call, at least.

comment 2y ago · link · parent

A few counterpoints:

* If going by the article, price has decreased from €130 to €95, a significant reduction even if not accounting for inflation.

* RAM has doubled from 2GB to 4GB.

* Per-core CPU performance has presumably increased considerably.

comment 2y ago · link · parent

No it's not.
1
789
12