Hacker News new | past | comments | ask | show | jobs | submit login

The logic of easy cross compiles doesn't really hold up for go translated SQLite. It depends on a huge pile of per platform support code, of varying quality. If you're only going to target known working platforms, may as well use cgo and a known working cross compiler.



Does compiling to WASM, using a cgo free WASM runtime, and replacing the OS layer (VFS) with portable Go code count?

That's the elevator pitch (so far) for: https://github.com/ncruces/go-sqlite3/tree/main


Yeah, that's cool. :) although probably a bit slower running through an interpreter.

Modernc/libc takes a rather different approach. It's got some pretty funny files in it. https://gitlab.com/cznic/libc/-/blob/master/musl_openbsd_arm...


It is slower.

The WASM runtime https://wazero.io has a compiler on amd64 and arm64 (on Linux, macOS, Windows, and FreeBSD), but the current compiler while very fast (at compiling), is very naive (generates less than optimal code).

An optimizing compiler is currently being developed, and should be released in the coming months. I'm optimistic that this compiler will cover the performance gap between WASM and modernc.


I don't think cznic's argument is about cross compiling but just being able to avoid cgo. Since some people really don't like cgo.


I don't think I understand what the argument for that is, because I've only ever heard it articulated as "cgo isn't go" which doesn't really convey much information.

Is this go? https://gitlab.com/cznic/libc/-/blob/master/libc_openbsd.go?...

I mean technically I suppose it is code that conforms to the go language grammar, but I'm not sure why a language purist would accept this.


"cgo isn't go" is repeated as a point of religion by some.

That said, I have a bunch of QEMU VMs just to compile cgo to platforms like OpenBSD, illumos, macOS, Windows, etc.

OpenBSD and such aren't that much of a hassle because it performs pretty well and these systems do what I tell them to do, unlike macOS and especially Windows, which are much more annoying and slower because they seem to spend most of their time running searching indexers, virus scanners, updaters, and who knows what, and then maybe perhaps, if the laptop is held at the right angle, and if it so behoves, also decides to spend some CPU cycles to my compiler.

Either way, the pain is real, at least for me. Although, yeah, that obviously isn't a solution.

In general I'm wary of write/translate from langX to langY. At a previous job another team was rewriting ColdFusion code to Go. "ColdFusion with Go syntax" was certainly a creative and novel use of the Go language. Translating from one language to another always seems hard because your brain gets "primed" by the source language, or something, and not all concepts necessarily map all that well in the first place – I have the same translating text, which I've generally found surprisingly hard.


when there is no logic behind such "dislike".

people are into programming because things can be reasoned, there is logic behind everything. yet there are non-senses that just try to waste people's time & energy by introducing some of their personal briefs backed by no logic into the whole thing.

cross-compiling regular c projects like sqlite should never be an excuse, I don't believe there is anything that can't be scripted when it come to cross-compiling sqlite.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: