pixelherodev opened a new pull request, #570: URL: https://github.com/apache/arrow-go/pull/570
Slight speed-up for a few string conversions. Strings are immutable. As such, `string([]byte(foo))`, given a mutable buffer, must copy the string, so that changes to the underlying slice do not break the language's requirements. `unsafe.String(foo, length)`, instead, crafts a string header pointing to the existing buffer. _So long as that buffer is never modified_ for the lifetime of the string, this can be totally safe, and is faster. Since the flatbufs will never be modified, it's totally safe to craft strings that point directly into its innards. The string pointer is sufficient to prevent GC, and we never modify that flatbuf data on read paths. Tests pass and there's a small but measurable performance improvement in profiles I was looking at. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
