HNHacker News
TopNewBestAskShowJobs

alecthomas

464 karma · joined March 2, 2008

http://twitter.com/alecthomas http://swapoff.org http://github.com/alecthomas alec@swapoff.org

[ my public key: https://keybase.io/alec; my proof: https://keybase.io/alec/sigs/EwhDB5ZFYHetGQT4QBxryMKudydFlHx6vfI2ZbYaXTY ]

hnchat:M7diobfazxWsK0TZ9aVm

submissionscomments
alecthomas··on Tracking developer build times to decide if the M3 MacBook is worth upgrading
My M2 defaults to using a "low power mode" when on battery, which I noticed initially because some graphics code I was writing was getting significantly lower frame rates when on battery.

Edit: 310fps vs 240fps

alecthomas··on Progress toward a GCC-based Rust compiler
> It’s funny you mention the different C++ compilers consider that Clang is well on its way of becoming the dominant compiler.

I'd be interested to know what metric you're basing this on.

Outside the Apple ecosystem, LLVM seems to have made very little inroads that I can see. No major Linux distribution that I'm aware of uses LLVM, and Windows is still dominated by MSVC.

alecthomas··on Inko Programming Language
Are there binaries for ivm? If ivm is intended to make it easier to manage inko versions, having to install it via another language's toolchain (Rust) seems a bit onerous.

Edit: Oh I see, ivm itself relies on Cargo to build inko rather than downloading binaries.

Still, it would be nice if it didn't need another language's toolchain just to use Inko :(

alecthomas··on I accidentally saved my company half a million dollars
Reminds me of the sadly dormant @shit_hn_says [1].

I'm guessing it's dormant because the level of discourse on HN has devolved to a point where nearly every comment on HN would now qualify.

[1] https://twitter.com/shit_hn_says

alecthomas··on WASI Support in Go
I understand there's no CGo specifically, but I'm wondering if the Go runtime when running under WASM still has to manage switching out the goroutine stacks for "WASM stacks" when it's calling out through the WASM VM.

Edit edit: from this comment it sounds like it is, as you say, just the general overhead of managing goroutine stacks. I wonder if TinyGo is more performant.

[1] https://news.ycombinator.com/item?id=37501552

alecthomas··on WASI Support in Go
I wonder if fmt.Printf() in particular is slow due to the CGo transition? Assuming there even is a CGo transition when compiled to WASM...
alecthomas··on WASI Support in Go
I believe the primary benefit is the sandboxing, but I imagine there are secondary benefits such as that the host platform can be any CPU architecture or OS.
alecthomas··on The underground economy of Glassdoor reviews
Interesting but not relevant here - they require a photo of a physical receipt, and they're hand reviewed. Anything is scammable given enough effort though, no doubt.
alecthomas··on The underground economy of Glassdoor reviews
https://www.productreview.com.au/ is the only site I've ever seen that does a good job at user reviews. Each review has to be accompanied by a verifiable receipt.

Here's their operating model, which sounds like a mix of paid brand manager subscriptions and advertising: https://support.productreview.com.au/hc/en-us/articles/36000...

alecthomas··on Wazero: Zero dependency WebAssembly runtime written in Go
There are a few, but I suspect the most widely used would be wasmtime. It's written in Rust and can be used from Go [2] but requires CGo (as mentioned by GP).

[1] https://github.com/bytecodealliance/wasmtime [2] https://github.com/bytecodealliance/wasmtime-go

alecthomas··on Don't Use Mocks
"Currently RR implements mocks, stubs, proxies, and spies. Fakes usually require custom code, so it is beyond the scope of RR."
alecthomas··on Reddit Doubles Down
I'd pay that to not have to use their awful mobile app or new.reddit
alecthomas··on Integrating Zig and SwiftUI
As I responded in a sibling comment, this is the point where ChatGPT goes completely off the rails and starts fabricating responses. Temper your awe :)
alecthomas··on Integrating Zig and SwiftUI
ChatGPT's responses start accurate then quickly go off the rails. The section from this point onwards is completely incorrect:

> Say I called a bunch of goroutines when I was in the Add function of the example you gave, would this be a problem?

The Go runtime is initialised once only in c-shared mode for the lifetime of the application - it would make no sense to do it on every function invocation, and be incredibly slow. So the answer to this section and the next one are just largely bogus.

ie. this response

> However, once you call a function via a C or Swift bridge, it becomes a synchronous operation and will block the calling thread until all goroutines have completed execution. Therefore, you would need to effectively manage the synchronization of these goroutines to avoid unnecessary blocking of the calling thread.

And the response to this question:

> You said in 4 the Go runtime may not keep running, does this mean that every invocation of the Add function has to spin up the whole Go runtime every time? Why cant it just stay alive inside the Swift process?

Are completely incorrect.

alecthomas··on How to start a Go project in 2023
go-binsize-treemap[1] is the best tool for this by a large margin. I came across it because of the exact same reason as you did actually, k8s client bloating my binary massively.

[1] https://github.com/nikolaydubina/go-binsize-treemap

alecthomas··on A detailed comparison of REST and gRPC
> What is the ubiquitous utility for interacting with gRPC? We have curl for REST. What is openAPI of gRPC?

grpcurl[1] combined with gRPC server reflection[2]. The schema is compiled into the server as an encoded proto which is exposed via server reflection, which grpcurl reads to send correctly encoded requests.

[1] https://github.com/fullstorydev/grpcurl [2] https://github.com/grpc/grpc/blob/master/doc/server-reflecti...

alecthomas··on MQTT vs. Kafka: An IoT Advocate's Perspective
> I'm a big fan of advertising the impossible on the front page.

Do you mean like Confluent do? https://www.confluent.io/blog/exactly-once-semantics-are-pos...

alecthomas··on yq: command-line YAML, JSON, XML, CSV and properties processor
That is simultaneously impressive and insane. Respect.
alecthomas··on yq: command-line YAML, JSON, XML, CSV and properties processor
It's a bit hard to be sure because YAML is so insane, but I would argue that yq's behaviour is not incorrect?

It is erroring on `*.html`, which is reasonable because `.html` is an invalid anchor identifier, though the error is not that useful. The parsing of the unquoted version numbers also seems to be "correct", in that things that look like numbers are supposed to be parsed as numbers.

alecthomas··on Golang disables Nagle's Algorithm by default
Not to understate the impact of the bug, but this is not the default for Go. It is used if CGo is disabled, as the issue you linked to describes.
alecthomas··on Devpod: Remote development environment at Uber
> hours of CI testing time introduced by having to run tests on the whole monorepo at each commit instead of just the project that changed.

This is rarely the case. Most monorepos shard tests such that wall time is minimised and have dependency analysis that only runs tests affected by the changed code.

More of a problem is that IDEs and LSPs often don't deal well with having to index and navigate very large codebases.

I've maintained both monorepo and polyrepo environments and there are pros and cons to both, and they vary _wildly_ based on the language being used.

alecthomas··on Ask HN: What do you like/dislike about Golang?
So true :D
alecthomas··on Building a custom code search index in Go
What a patronising response to a report of 500+ results missing from your index :) How will you improve your product if you can't accept feedback?

Edit: typo

alecthomas··on Building a custom code search index in Go
> But let me know where it’s not doing what you expect and I’ll fix it.

I would expect > 0 results for the above search

Same search on SourceGraph: https://sourcegraph.com/search?q=context:global+kong.New&pat...

alecthomas··on Building a custom code search index in Go
Great read, but a basic search yields zero results:

https://searchcode.com/?q=kong.New+lang%3Ago

Same search on GitHub:

https://github.com/search?type=code&q=kong.New

Edit: there also doesn't seem to be any ranking at all, such as exact word matches being boosted

alecthomas··on Build the Modular Monolith First
100% agreed there. I've never seen this go smoothly, and usually the monolith lives forever, slowly shedding functionality but never quite disappearing.
alecthomas··on Show HN: Xq – command-line XML and HTML beautifier and content extractor
Works fine for me, what doesn't work?

    $ curl -fsSL 'https://ap-playerservices.streamtheworld.com/api/livestream?station=NOVA_919&version=1.9' | xq -x //transport
    http
    hls
    hlsts
    http
    http
    hls
    hlsts
    http
    hls
    hlsts
alecthomas··on Lunatic: Erlang-Inspired Runtime for WebAssembly
I love the approach of Lunatic. It really fulfils the promise of WASM I think, as a universal general purpose runtime.
alecthomas··on Show HN: Devbox – Easy, predictable shells and containers
Yeah I assume so too, but I'm not sure.
alecthomas··on Show HN: Devbox – Easy, predictable shells and containers
No, it uses native Nix directly on your machine - Linux, Mac, or Windows. Its integration with Docker is that it can _build_ Docker images from the Nix packages in your "devbox".
← PreviousPage 2 of 7Next →