News for hackers. Stuff that matters.

mwsherman

Re:Everyone Should Know SIMD on Thursday July 23, 2026 @10:57AM (#49022708)
I recommend starting with SWAR [1] before SIMD. Our registers are typically 64 bits, and one can try out SIMD patterns without taking a dependency on particular hardware.

This will only be effective if the data you’re working on is smaller than 64 bits. If you’re working with bytes, for example, you might get 8x parallelism.

[1] https://en.wikipedia.org/wiki/SWAR

Re:So, you want to chunk really fast? on Monday January 05, 2026 @03:15PM (#46504238)
While this article is about perf — and trading off semantic precision by design — there is a Unicode standard for sentence boundaries, may be interesting: https://www.unicode.org/reports/tr29/#Sentence_Boundaries

I implemented the sentence boundaries, but also thought that the notion of a “phrase” might be useful for such applications: https://github.com/clipperhouse/uax29/tree/master/phrases

Re:Go's escape analysis and why my function return worked on Thursday December 11, 2025 @10:22AM (#46232489)
Shameless plug, if one wishes to track down allocations in Go, an allocations explorer for VS Code: https://marketplace.visualstudio.com/items?itemName=Clipperh...
Re:A “frozen” dictionary for Python on Thursday December 11, 2025 @09:17AM (#46231657)
I’ve found C#’s frozen dictionary to be useful: https://learn.microsoft.com/en-us/dotnet/api/system.collecti...

It’s optimized for fast reads in exchange for expensive creation.

Re:Go Subtleties You May Not Know on Wednesday October 22, 2025 @11:44AM (#45670870)
That’s true, converting in either direction will typically allocate. Which it must, semantically.

One can use unsafe for a zero-copy conversion, but now you are breaking the semantics: a string becomes mutable, because its underlying bytes are mutable.

Or! One can often handle strings and bytes interchangeably with generics: https://github.com/clipperhouse/stringish

Re:Go Subtleties You May Not Know on Wednesday October 22, 2025 @11:01AM (#45670197)
There is mention of how len() is bytes, not “characters”. A further subtlety: a rune (codepoint) is still not necessarily a “character” in terms of what is displayed for users — that would be a “grapheme”.

A grapheme can be multiple codepoints, with modifiers, joiners, etc.

This is true in all languages, it’s a Unicode thing, not a Go thing. Shameless plug, here is a grapheme tokenizer for Go: https://github.com/clipperhouse/uax29/tree/master/graphemes

Re:Go Subtleties You May Not Know on Wednesday October 22, 2025 @10:55AM (#45670075)
In Go, string effectively serves as a read-only slice, if we are talking about bytes.

ReadOnlySpan<T> in C# is great! In my opinion, Go essentially designed in “span” from the start.

Re:Show HN: I wrote a full text search engine in Go on Thursday October 09, 2025 @05:48PM (#45533460)
Shameless plug, you may wish to do Lucene-style tokenizing using the Unicode standard: https://github.com/clipperhouse/uax29/tree/master/words
Re:Safe zero-copy operations in C# on Tuesday September 30, 2025 @10:36AM (#45426021)
I move between Go and C#. I wrote a zero-allocation package in Go [1] and then ported to C# — and the allocations exploded!

I had forgotten, or perhaps never realized, that substrings in C# allocate. The solution was Spans.

Notably, it caused me to realize that Go had “spans” designed in from the start.

[1] https://github.com/clipperhouse/uax29

Show HN: Go Allocations Explorer for VS Code

https://marketplace.visualstudio.com/items?itemName=Clipperhouse.go-allocations-vsix

I’ve learned that my intuitions about where an allocation is coming from aren’t always correct. One tracks it down by creating a -memprofile then go tool pprof, and then some searching. It’s all fine, but tedious.So, I’ve put that process into a VS Code sidebar, where one simply clicks a benchmark and gets a list of allocations, with a link to the source line.Hope you’ll try it and give...

( Read More... | no comments | 3 points | on HN )
Re:The GitHub website is slow on Safari on Wednesday August 27, 2025 @10:48AM (#45040493)
Putting on eng manager hat, the problem to solve is that this regression went undetected, not that Safari is slow.

The solution is a test that fails when Chrome and Safari have substantially different render times.

Re:SIMD-friendly algorithms for substring searching on Saturday June 14, 2025 @01:34PM (#44277625)
C# has implemented some SIMD for IndexOf: https://github.com/dotnet/runtime/pull/63285
Re:Net 9.0 LINQ Performance Improvements on Friday October 18, 2024 @05:31PM (#41883692)
Here’s a way to write tests next to the code: https://clipperhouse.com/go-test-csharp/

(Whether I recommend it, not sure! I did it and then undid it, with suspicion that tests were taking longer due to, perhaps, worse caching of build artifacts.)

Older »