Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
benhoyt
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
20 ms
·
271.
▲
by
benhoyt
5y ago
Totally agreed: almost all users (me/GoAWK included) want performance and don't care nearly as much about simplicity under the hood. Simplicity of implementation is of value for educational purposes, but we could easily have a s
272.
▲
by
benhoyt
5y ago
I find this a bit surprising -- do you have numbers? Though even if compiling them is relatively slow it doesn't matter too much, because usually you're compiling once and evaluating many many times (e.g., in the case of a typical
273.
▲
by
benhoyt
5y ago
Interesting, though not too surprising. Do you remember what the regexes were that your assignment used? Go's regexp package does have a couple of advantages over Python, Perl, and so on: 1) it's guaranteed linear time in the leng
274.
▲
by
benhoyt
5y ago
Go isn't the most efficient language for these sorts of things, but it's also not bad (and Go itself is not really the bottleneck for real-world AWK scripts). That said, GoAWK is useful mainly when you want to use AWK scripts in a
275.
▲
by
benhoyt
5y ago
Just the Go benchmarking tools built into "go test", as well as a couple of scripts of my own just using "time ./goawk 'BEGIN { ... test script ... }'" and that kind of thing. Nothing fancy!
276.
▲
by
benhoyt
5y ago
Good question. A bit of experience, some guesswork, and a lot of testing and benchmarking along the way. I separated out global and local opcodes originally because I wanted individual variable accesses to be fast (why do at runtime what yo
277.
▲
by
benhoyt
5y ago
Code generation is used quite a bit in Go, though I haven't seen it used quite like this before. Now you've got me thinking what an rp-like tool would look like in Go. I think the error handling and statement vs expression distinc
278.
▲
by
benhoyt
5y ago
rp looks like a very interesting and clever approach. I'll have to take a closer look. Is https://github.com/c-blake/cligen/blob/master/examples/rp.ni... the extent of rp's documentation?
279.
▲
by
benhoyt
5y ago
Yeah, I discuss something similar in the article, except I use an array of functions (search for "array of functions"), which is significantly faster than hashing and a hash table lookup. It was very slightly faster than switch, b
280.
▲
Optimizing GoAWK with a bytecode compiler and virtual machine
(benhoyt.com)
102 points
by
benhoyt
5y ago
|
23 comments
281.
▲
by
benhoyt
5y ago
Hehe. Well, if you look at the previous release it shows 99.7% percent of (a smaller number of) the tests passing. So you've got the best of both worlds. :-)
282.
▲
by
benhoyt
5y ago
Yeah, fair concern. I saw a while back (looks like Aug 2020) that he got all 928,000 SQLite tests passing -- search for "0 errors out of" on this page: https://pkg.go.dev/modernc.org/sqlite#section-readme
283.
▲
by
benhoyt
5y ago
crawshaw/sqlite actually uses CGo -- it's a wrapper around the C version of SQLite. For example, see https://github.com/crawshaw/sqlite/blob/23d646f8ac00d9dd2390... zombiezen/go-sqlite uses czn
284.
▲
by
benhoyt
5y ago
The same author ("cznic") has also built a C-to-Go compiler/transpiler and used it to convert SQLite to pure Go source, so that it doesn't require CGo: https://gitlab.com/cznic/sqlite ... the conver
285.
▲
by
benhoyt
5y ago
Yes, you're right. Saying that it didn't change "at all" was perhaps overstatement. But those are all very subtle changes. I've coded Go daily for 3-4 years and never been affected by them, except the tags one -- I
286.
▲
by
benhoyt
5y ago
Nit: they're adding Generics in 1.18 (not 1.8). Regarding "another 5 years": I'm not so sure. Go is very conservative about language changes. The type system didn't change at all from version 1.0 through version 1.1
287.
▲
by
benhoyt
5y ago
Just a note: I overloaded (excuse the pun) the word "static": I didn't mean the "static" keyword, but "statically compiled/typed". So it doesn't mean singletons, just that you pass dependencies a
288.
▲
by
benhoyt
5y ago
Ah, that explains the confusion. Yeah, I didn't mean static as in the "static" keyword in Java / C++, but as in specified in the statically-typed code. Defining constructors that accept dependencies -- exactly. Ah yeah,
289.
▲
by
benhoyt
5y ago
Why do "static references become a tangled mess"? In my (limited) experience with runtime DI libraries (albeit in Go) they turn clear, IDE- and debugging-friendly code where the compiler tells you at compile time if you got it wro
290.
▲
by
benhoyt
5y ago
When my wife and I lived in Brooklyn, her optometrist's name was Dr. Vivien Vu and her dentist's name was Dr. Samantha Ifill (I kid you not -- look them up). I haven't read the paper yet, but my theory is simply that when a n
291.
▲
by
benhoyt
5y ago
I've also used Snowplow fairly heavily (several years ago). It's good for big stuff where you need lots of control and data customization, but it's significantly overkill if you just want basic analytics for your blog or smal
292.
▲
by
benhoyt
5y ago
I wrote two articles about this for LWN last year. Several of them are self-hostable. Summary: https://lwn.net/Articles/822568/ : lightweight options: GoatCounter and Plausible (open source), Simple Analytics and F
293.
▲
by
benhoyt
5y ago
Interesting! I recently did something similar based on my GoAWK interpreter (an AWK interpreter written in Go): I wrote a compiler that tries to statically infer types and compile a subset of AWK to Go source: https://benhoyt.com
294.
▲
by
benhoyt
5y ago
I'm not entirely sure why they titled the article this way, as it sounded (to me and others) like LWN is saying goodbye, rather than a staff member retiring from LWN. The former would be very sad. Anyway... I just wanted to say how hi
295.
▲
by
benhoyt
5y ago
Yes, after some discussion and minor modifications (and removal of a few features): https://github.com/golang/go/discussions/47323 ... I understand the motivation for this new package, but it does seem like a
296.
▲
Microservices solve a people problem, not a technical one
(benhoyt.com)
3 points
by
benhoyt
5y ago
|
0 comments
297.
▲
The Go compiler needs to be smarter (2020)
(lemire.me)
3 points
by
benhoyt
5y ago
|
0 comments
298.
▲
by
benhoyt
5y ago
You can define that yourself as "type token = struct{}" or similar. In my experience struct{} occurs even less than interface{}, and it's also 3 characters shorter already, so it's not worth a builtin. I use "chan s
299.
▲
by
benhoyt
5y ago
Counterpoint: I'm an experienced Go dev but still think of "interface{}" as a semi-special "any" type, just because it fits my brain better conceptually. "Any type" is simpler than "an interface with
300.
▲
The Vaccine Moment, part two
(paulkingsnorth.substack.com)
7 points
by
benhoyt
5y ago
|
0 comments
More ›