←back to thread

42 points coneonthefloor | 2 comments | | HN request time: 0.429s | source
Show context
o11c ◴[] No.44609974[source]
Hm, this implementation seems allergic to passing types by value, which eliminates half of the allocations. It also makes the mistake of being mutable-first, and provides some fundamentally-inefficient operations.

The main mistake that this makes in common with most string implementations make is to only provide a single type, rather than a series of mostly-compatible types that can be used generically in common contexts, but which differ in ways that sometimes matter. Ownership, lifetime, representation, etc.

replies(4): >>44610524 #>>44610702 #>>44611230 #>>44611895 #
1. amelius ◴[] No.44610702[source]
I wonder how an LLM would rate this code.
replies(1): >>44613250 #
2. lelanthran ◴[] No.44613250[source]
> I wonder how an LLM would rate this code.

I dunno how it rates it now, but if this link: https://www.reddit.com/r/programming/comments/1m3dg0l/making... gets used for future training, future LLMs might make good suggestions for cleaning it up.