-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
runtime, strings, bytes: undo use of runtime as dumping ground for shared code #19792
Comments
It would be good for neither bytes to depend on strings nor strings to depend on bytes. Everything depends on runtime so that's the dumping ground. If we want an internal package that both bytes and strings depend on, that seems OK. |
Also, on March 30, "this issue is to continue/resolve the discussion." Should anyone else be in this discussion? |
@bradfitz points out that maybe there's no good reason to disallow strings -> bytes or vice versa (obviously we can't have both). So the effect of one or the other should be considered too. |
@randall77, do you want to make this decision? I'm fine with either a new internal package, or strings depending on bytes. (if we have to pick a dependency direction, it intuitively makes more sense for strings to depends on bytes, since strings are made of bytes... but that's pretty arbitrary) |
Here's the list of assembly functions that are currently in
I think all the I'm ok for these functions to live in I'll fix this for 1.11. strings->bytes unless someone comes up with a good name. |
Perhaps a combination of |
Some more suggestions from a friend: data, mem, rawdata, rawmem. |
@mvdan, there's nothing "runtime" about such a new package, though, so blending in "r" or "run" to the name doesn't make much sense.
I'm fine with I'm also fine with strings depending on bytes. @randall77, can you pick something and do this earlier in the cycle than later? Some CLs like https://go-review.googlesource.com/c/go/+/87935 depend on it. |
Change https://golang.org/cl/87935 mentions this issue: |
Ping @randall77, unless you're on vacation. |
Just back today. I will get to this this week. |
Change https://golang.org/cl/98016 mentions this issue: |
Move the IndexByte function from the runtime to a new bytealg package. The new package will eventually hold all the optimized assembly for groveling through byte slices and strings. It seems a better home for this code than randomly keeping it in runtime. Once this is in, the next step is to move the other functions (Compare, Equal, ...). Update #19792 This change seems complicated enough that we might just declare "not worth it" and abandon. Opinions welcome. The core assembly is all unchanged, except minor modifications where the code reads cpu feature bits. The wrapper functions have been cleaned up as they are now actually checked by vet. Change-Id: I9fa75bee5d85db3a65b3fd3b7997e60367523796 Reviewed-on: https://go-review.googlesource.com/98016 Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Change https://golang.org/cl/98355 mentions this issue: |
Move bytes.Equal, runtime.memequal, and runtime.memequal_varlen to the bytealg package. Update #19792 Change-Id: Ic4175e952936016ea0bda6c7c3dbb33afdc8e4ac Reviewed-on: https://go-review.googlesource.com/98355 Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Change https://golang.org/cl/98495 mentions this issue: |
Change https://golang.org/cl/98515 mentions this issue: |
Move bytes.Count and strings.Count to bytealg. Update #19792 Change-Id: I3e4e14b504a0b71758885bb131e5656e342cf8cb Reviewed-on: https://go-review.googlesource.com/98495 Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Move bytes.Compare and runtime·cmpstring to bytealg. Update #19792 Change-Id: I139e6d7c59686bef7a3017e3dec99eba5fd10447 Reviewed-on: https://go-review.googlesource.com/98515 Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Change https://golang.org/cl/98518 mentions this issue: |
From CL 38693:
@martisch said:
@randall77 replied:
This issue is to continue/resolve the discussion.
The text was updated successfully, but these errors were encountered: