New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
html: optimize EscapeString and UnescapeString with avx instructions #53410
Comments
The performance of functions html.EscapeString and htmlUnescapeString in _amd64 can benefit from the use of avx instructions. We propose to implement avx-optimized versions of both. It can be shown that significant improvements are possible for the benchmarks EscapeNone, UnescapeNone, Unescape, UnescapeSparse, UnescapeDense, and Escape. |
Not sure if there are going to be people to maintain assembly code for that in the standard library. |
Change https://go.dev/cl/412834 mentions this issue: |
cc @nigeltao ? |
I'm not familiar with the official proposal process, so @ianlancetaylor
However, I am not in favor of the idea, based on https://go.dev/cl/412834 adding 2000 lines of assembly plus 5000 lines of data tables. Performance is just one of the goals of the source code in the go standard library (and its golang.org/x extended family). Another goal is maintainability (as @seankhliao said). Another goal is teachability - many people read the stdlib and golang.org/x to learn how to write idiomatic Go code. Furthermore, Go is a memory-safe language, which is important to many of its users. There is a high bar for accepting patches that break that feature. The CL description (and this issue) also does not provide any benchmark numbers. For argument's sake, even if it sped up html.Escape by 2x, if a web server program spends only 1% of its time inside html.Escape, the overall effect is a 100 / 99.5 = 1.005x speed-up, which is hard to get excited about given the costs outlined above. You are obviously free to publish your own fastunsafehtmlescape package and other programmers can easily opt into using that if they want its trade-offs. |
This proposal has been declined as infeasible. |
No description provided.
The text was updated successfully, but these errors were encountered: