is OpenBSD 10x faster than Linux?
Tagged: openbsd
The go module proxy caches requests from users, so everyone has a consistent and reliable experience regardless of upstream host. But what if the go proxy is contributing to the instability of the upstream host? There have been other complaints about the go proxy, that’s just the way it works, but I collected a few minutes of logs to examine that may be interesting.
more...
Whenever a bug is discovered, it’s immediately apparent that three things have gone wrong. They used the wrong language, and this never would have happened if they’d written it in the bugfree language. They used the wrong development methodology, and this never would have happened if they’d used the prevent this bug technique. And finally, they ignored best practice and didn’t use the proper coding style. The bug would have been extremely obvious if only they’d replaced all v_w_ls with underscores in variable names. Just look at the word v_w_ls. It pops right out.
more...
Perl has a regex option /o, which pretends to optimize your code, but actually introduces bugs. Go has been missing out. Until now.
We need regexp of course, but also text/template for interpolation. Add in runtime to get the pc, and we have all the elements for a cache of only once regex.
func Compile(s string, vals any) (*regexp.Regexp, error) {
cacheMtx.Lock()
defer cacheMtx.Unlock()
pc, _, _, _ := runtime.Caller(1)
k := key{s: s, pc: pc}
re := cache[k]
if re != nil {
return re, nil
}
t := template.New("regex")
t, err := t.Parse(s)
if err != nil {
return nil, err
}
var sb strings.Builder
err = t.Execute(&sb, vals)
if err != nil {
return nil, err
}
re, err = regexp.Compile(sb.String())
if err != nil {
return nil, err
}
cache[k] = re
return re, nil
}
type key struct {
s string
pc uintptr
}
var cacheMtx sync.Mutex
var cache = make(map[key]*regexp.Regexp)
And a test program.
func main() {
fmt.Printf("starting\n")
inputs := []string{"Apple", "bananas", "42"}
for i := 0; i < 3; i++ {
re, err := regexpo.Compile("{{ call .Letters }}", map[string]any{
"Letters": func() string {
time.Sleep(1 * time.Second)
fmt.Printf("substitute\n")
return "[a-z]"
},
})
if err != nil {
fmt.Printf("failure: %s\n", err)
return
}
ok := re.MatchString(inputs[i])
fmt.Printf("match: %v\n", ok)
}
fmt.Printf("done.\n")
}
The substitution is only done once.
The web as we know it will soon crash and burn in a fiery death. 12 days. There’s even a countdown. This is apparently a redux of request smuggling reborn. Request research reborn redux.
more...
There was an (almost) catastrophic OpenZFS bug. If they had used zig, the bug would be easily detected. But the question remains, could we detect this bug in C?
more...
Once upon a time, there was a university president who couldn’t send an email more than 500 miles, and the wise sysadmin said that’s not possible, so the president said come to my office, and lo and behold, the emails stopped before going 500 miles. Has technology improved? Can we send an email farther than 500 miles in 2025?
more...
I had the idea to write a little shell in go. Called gosh, of course. There’s a few people playing with the same theme, but nothing exactly the same.
more...
People keep telling me that X11 doesn’t support DPI scaling, or fractional scaling, or multiple monitors, or something. There’s nothing you can do to make it work. I find this surprising. Why doesn’t it work? I figure the best way to find out is try the impossible and see how far we get.
more...
I like to go on the internet and click on links, but some of the links are bad, so then I swipe right to make it go away. The problem is that when I’m running chrome on OpenBSD, the swipe gesture doesn’t seem to work like it does on other platforms. We’re not going to fix it, but we are going to make it work. (Although, I hear the younglings say they swipe right when they like something. Explains a lot, actually.)
more...