Ok, I'm going to try to restate the issues raised and answer them one by one. If I misunderstand, please let me know.
1. The GC needs to know if a pointer is actually a pointer. Solution: Check if the high bit is set. If it is, you know for sure that it is not a pointer. It actually doesn't matter if the cpu ignores the top 16 bits or not. The point is that the top 8 bits will never be used in an actual pointer, and that is all we care about for this implementation. 2. This only works for x86-64 Solution: I don't even think it is hyperbolic to say that 99% of all go running in production is on x86-64. So even if this optimization is only implemented for x86-64, it is well worth it. The rest could be take care of by a stubbed out isSmallString(s string) bool that always returns false, and let the compiler remove all the small string code from the resulting binary. Am I missing anything else? On Tuesday, January 31, 2017 at 9:12:24 PM UTC-8, Eliot Hedeman wrote: > > I was writing up a proposal about adding the small string > optimization(putting strings on the heap if they will fit within the > sringStruct)to the go runtime, and I realized there might be good reason > why this has not been done yet. Are there any glaring reasons you can think > of? Here > <https://gist.github.com/eliothedeman/a5806ff5fed357f78ae58bd79251faea> is > the *really* rough draft of the proposal. Thanks for the feedback! > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.