HNHacker News
TopNewBestAskShowJobs

mwsherman

3,607 karma · joined July 21, 2009

https://clipperhouse.com/
submissionscomments
mwsherman··on Everyone should know SIMD
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

mwsherman··on So, you want to chunk really fast?
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

mwsherman··on Go's escape analysis and why my function return worked
Shameless plug, if one wishes to track down allocations in Go, an allocations explorer for VS Code: https://marketplace.visualstudio.com/items?itemName=Clipperh...
mwsherman··on A “frozen” dictionary for Python
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.

mwsherman··on Go subtleties
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

mwsherman··on Go subtleties
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

mwsherman··on Go subtleties
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.

mwsherman··on Ask HN: What are you working on? (October 2025)
A Go allocations explorer for VS Code. Extension: https://marketplace.visualstudio.com/items?itemName=Clipperh...

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

mwsherman··on Show HN: I wrote a full text search engine in Go
Shameless plug, you may wish to do Lucene-style tokenizing using the Unicode standard: https://github.com/clipperhouse/uax29/tree/master/words
mwsherman··on Safe zero-copy operations in C#
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

mwsherman··on The GitHub website is slow on Safari
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.

mwsherman··on SIMD-friendly algorithms for substring searching (2016)
C# has implemented some SIMD for IndexOf: https://github.com/dotnet/runtime/pull/63285
mwsherman··on Net 9.0 LINQ Performance Improvements
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.)

mwsherman··on Let's build a full-text search engine
As you get into this, you’ll want to improve the tokenization to something less naive. (The naive approach is fine for the educational purpose of the article.)

I’ve made the mistake of simply splitting on spaces or punctuation, and eventually finding that will do the wrong thing.

Eventually I learned about Unicode text segmentation[0], which solves this pretty well for many languages. I believe the default Lucene tokenizer uses it. I implemented it for Go[1].

[0] https://unicode.org/reports/tr29/ [1] https://github.com/clipperhouse/uax29

mwsherman··on Bullshit Jobs
What allows a firm to stay competitive if there are many apparently wasteful tasks being done? Should that firm not be superseded by competitors offering better efficiency (reflected in prices) or consumer benefit?

I keep coming back to theory-of-the-firm: https://en.wikipedia.org/wiki/Theory_of_the_firm

An industry that accommodates a lot of bullshit work is an industry with high transaction costs. The author hints at that at the end of the article, but leaves it an open question.

mwsherman··on Why the New V8 Is So Damn Fast
I speculated recently that TypeScript might _de facto_ help V8 optimizations, and the post seems to confirm that. https://clipperhouse.com/does-typescript-make-for-more-perfo...
mwsherman··on McDonald's Unveils Limited Edition MacCoin to Celebrate 50 Years of the Big Mac
Some background, The Economist uses the Big Mac as a measure of purchasing power: https://www.economist.com/news/2018/07/11/the-big-mac-index
mwsherman··on Apple has a record $250B in the bank
If they really want to redistribute, they could reduce prices. They could return to shareholders, sure, but returning to the market (of their customers) would be more economically valuable.
mwsherman··on Nobody Knows What They're Doing (2013)
Think in terms of natural selection. Behaviors (and personalities) that make more successful choices in that environment will tend to survive in the environment, regardless of whether they know what they are doing.

Most of the bumbling fails. Some of the bumbling works. And so the most “effective” politicians (and organizations) will survive, even if their success has little to do with deliberate scheming.

mwsherman··on FCC rescinds claim that AT&amp;T and Verizon violated net neutrality
In this narrow case, I believe there may be a claim that those bits are not “Internet” service. They are private network traffic, within their respective networks.
mwsherman··on Study: carpooling apps could reduce traffic 3x in NYC
The article doesn't make the claim in this headline. It makes the claim that NYC could theoretically have 3x fewer cabs. @dang
mwsherman··on RoslynLinqRewrite – Compiles C# by rewriting and optimising LINQ expressions
Oh, and a question – is the generated code actually semantically identical? For most uses practical uses, it is, but I think under racy conditions it could give different results.
mwsherman··on RoslynLinqRewrite – Compiles C# by rewriting and optimising LINQ expressions
Looks nice. A lot of people don’t realize how expensive Linq can be. That said, my preference for most (source) codegen is in the editor – this would be nice as an editor plugin.
mwsherman··on The Netflix Backlash: Why Hollywood Fears a Content Monopoly
The word “Hollywood” itself refers to a monopoly. This article reads like a status quo that is accustomed to power and resistant to sharing it.
mwsherman··on What Can Hitters Actually See Out of a Pitcher’s Hand?
Really interesting documentary on this: https://www.netflix.com/search/fastball
mwsherman··on Fancy Dorms Aren’t the Main Reason Tuition Is Skyrocketing
This has been studied in other places. It appears to have a lot more to do with the subsidy of student loans: http://www.nber.org/papers/w21967

I.e., more dollars chasing the same amount of education. A bit more explanation here: https://fee.org/articles/student-loan-subsidies-cause-almost...

mwsherman··on Are Cities Too Complicated?
Another word for complexity is diversity. Resilience comes from that complexity. Very much like biology.

NYC (where I live) is wildly inefficient, except at delivering benefits that millions of people consider worthwhile.

mwsherman··on ‘The Market Is Saturated’: Brooklyn’s Rental Boom May Turn into a Glut
I live in one of those buildings. It's about 12 minutes to work in downtown Manhattan if the train timing works out.

I am unclear if this article is quoting the "net effective" rate, where the free month is amortized over a year. Mine is around $2750 effective, while monthly is around $2950.

mwsherman··on The bandwidth bottleneck that is throttling the Internet
Good point. The utility of incremental bandwidth diminishes quickly. https://www.igvita.com/2012/07/19/latency-the-new-web-perfor...
mwsherman··on American truck drivers could lose their jobs to robots
This is a perfectly reasonable intuition – that there will be large net loss of jobs as trucks are automated – but we should not mistake the intuition for evidence. There is a long history of believing that massive job losses are imminent due to technological advance.

The problem with mistaking this fear for a fact is that it often leads to an incorrect intervention. (I call this a WMD argument.)

We’d be much better served with much greater caution about what is actually, observably, measurably true. In this case, we’d have to discover the yet-unfound correlation between technical advance and employment rate.

Page 1 of 14Next →