3 ms·
I think you kinda missed the point. The point is that trying to make a user-friendly API with the familiar, highly composable, and extremely common io.Reader th
by Groxx 1y ago
I think you kinda missed the point. The point is that trying to make a user-friendly API with the familiar, highly composable, and extremely common io.Reader that everything (including Go's stdlib) encourages you to use ends up putting you in this unfortunate design corner if you also care about performance.
It's frustration about getting close to a good API, but not having any reasonable way to close the final gap, forcing you do you to [do] stuff like you mentioned: have multiple near-identical APIs for performance, and needing your users to understand and use them correctly to get a good result.
- porridgeraisin 1y agoBut if you have two modes of operation: - Reading in memory data - Reading from a stream Then whats wrong with having two different APIs to use each mode? Instead of you doing a if (detect in memory) in your code, it's just two different functions.
- Groxx 1y agoNothing. Or next to nothing at worst. It would just be nice if it could automatically do the best thing.