32 karma · joined November 6, 2019
The import path is disconnected from where the build system looks for the files. Of course, the default is to use the import path as an URL, right, but nothing forces you to do that. And if you do, *you* lock yourself to the hosting you use. But that can be hardly blamed on Go.
Documentation here: https://pkg.go.dev/cmd/go#hdr-Remote_import_paths
Full example: https://github.com/rsc/swtch/blob/master/app/rsc-io/main.go
tl;dr: Serve this at your domain, update the repo-root when changing host platform for your code: <meta name="go-import" content="import-prefix vcs repo-root">. No one else has to do anything.
With the recent release of ncruces' drive switching from wazero to wasm2go, there have been expectations of possibly substantial improvements. Our numbers confirm this: the wasm2go-based driver (ncruces) has recovered significant ground compared to the February results, narrowing the gap with its competitors. The driver erased its worse performance on targets not natively supported by wazero. Well done, u/ncruces!
Sometimes we need block scoped cleanup, other times we need the function one.
You can turn the function scoped defer into a block scoped defer in a function literal.
AFAICT, you cannot turn a block scoped defer into the function one.
So I think the choice was obvious - go with the more general(izable) variant. Picking the alternative, which can do only half of the job, would be IMO a mistake.
Only if the type is not a pointer per se or does not contain any inner pointers.
Otherwise the garbage collector will bite you hard.
I find it quite usable.
No one disputed that. But it follows that your benchmarks are comparing C to [some very] outdated versions of Go packages. Which is what I tried to point out.
See https://pkg.go.dev/modernc.org/sqlite-bench#readme-tl-dr-sco... for the numbers using the more recent versions.
Ad performance. In some micro benchmarks the Go version is ~4x slower: https://gitlab.com/cznic/libquickjs/-/blob/675ee343753c42341...
However, it's already ~25% faster, in a different benchmark, than another Go JS VM written from scratch: https://pkg.go.dev/modernc.org/quickjs@v0.14.0#hdr-Performan...
I am currently looking around if it can be improved more and there are some ideas to try out.
go.mod files just list the dependencies of their respective package.
- Easily cross-compile these executables for other systems
Optimizations give better results when care is taken first about the most costly parts.
$ CGO_ENABLED=0 go install modernc.org/visualmd@latest
"It is rare to Close a DB, as the DB handle is meant to be long-lived and shared between many goroutines."
The correct title should read "Go named constants suck", but then I'm not sure what's wrong about them.
The name of the repo is really and intentionally misleading. rsc filled an issue there to point this out, but the repo maintainer just disabled issues altogether so now no one can see it.
Even when it would not have such parasitic name, many seasoned Go programmers, me included, consider the self-proclaimed "Standard Go project Layout" as the opposite of what is good and advisable.
Unfortunately, the name just works, so it is being recommended all over the Internet since its inception.