Better HN
topnewbestaskshowjobs
Log inSign up

mwsherman

3,607 karma · joined Jul 21, 2009 (17y ago) · 667 submissions

https://clipperhouse.com/
Submissions

comment 4mo ago · link · parent

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

comment 10mo ago · link · parent

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

comment 11mo ago · link · parent

Shameless plug, if one wishes to track down allocations in Go, an allocations explorer for VS Code: https://marketplace.visualstudio.com/items?itemName=Clipperh...

comment 11mo ago · link · parent

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.

comment 1y ago · link · parent

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

comment 1y ago · link · parent

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

comment 1y ago · link · parent

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.

8.

Making Unicode things fast in Go(clipperhouse.com ↗)

2 points · by mwsherman · 1y ago · discuss

comment 1y ago · link · parent

A Go allocations explorer for VS Code. Extension: https://marketplace.visualstudio.com/items?itemName=Clipperh...

Source: https://github.com/clipperhouse/go-allocations-vsix

comment 1y ago · link · parent

Shameless plug, you may wish to do Lucene-style tokenizing using the Unicode standard: https://github.com/clipperhouse/uax29/tree/master/words

comment 1y ago · link · parent

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

12.

Show HN: Go Allocations Explorer for VS Code(marketplace.visualstudio.com ↗)

4 points · by mwsherman · 1y ago · discuss

13.

Allocations Are a Dependency(clipperhouse.com ↗)

1 points · by mwsherman · 1y ago · discuss

14.

I deal with copyright claims [video](youtube.com ↗)

2 points · by mwsherman · 1y ago · discuss

15.

Yagni for Distributed Rate Limiting(clipperhouse.com ↗)

1 points · by mwsherman · 1y ago · discuss

comment 1y ago · link · parent

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.

17.

Show HN: A more composable rate limiter for Go(github.com ↗)

1 points · by mwsherman · 1y ago · discuss

18.

Casey Handmer on powering data centers [video](youtube.com ↗)

4 points · by mwsherman · 1y ago · discuss

19.

Is a "routing" LLM isomorphic with a single large model?(twitter.com ↗)

2 points · by mwsherman · 1y ago · 1 comment

20.

Designing a Composable Rate Limiter(clipperhouse.com ↗)

4 points · by mwsherman · 1y ago · discuss

comment 1y ago · link · parent

C# has implemented some SIMD for IndexOf: https://github.com/dotnet/runtime/pull/63285

22.

Self-Hosted x86 Back End Is Now Default in Debug Mode(ziglang.org ↗)

1 points · by mwsherman · 1y ago · discuss

23.

Poor spill decisions making code 14% slower(github.com ↗)

8 points · by mwsherman · 1y ago · discuss

comment 2y ago · link · parent

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.)

25.

The River, the Village, and the Fort: Nate Silver's New Book, "On the Edge"(statmodeling.stat.columbia.edu ↗)

2 points · by mwsherman · 2y ago · discuss

26.

C# almost has implicit interfaces(clipperhouse.com ↗)

53 points · by mwsherman · 2y ago · 71 comments

12345
23