On Fri, Feb 26, 2021 at 7:20 AM Than McIntosh <th...@google.com> wrote: > > > My sense is that developers are using packages like reflect2 for performance > reasons, very often to try to improve JSON marshalling/unmarshalling speed. > These packages tend to bypass the Go type system using "unsafe" in order to > provide reflect-like operations without the overhead (e.g. allocation) that > would be incurred if they used the regular reflect package in the standard > library. > > Because these packages are "reaching under the hood" via unsafe, they tend to > be written against a specific implementation (and in fact against a specific > version of a specific implementation). So probably not surprising that they > do not play well with gccgo/gollvm.
OK, but the reflect package generally does not allocate, so what is the advantage of reflect2? Are there benchmarks showing where reflect2 is significantly faster? (I'll note that while this may not be a good idea for the overall ecosystem, I expect that it is possible to port reflect2 to support gccgo/GoLLVM.) Ian > On Fri, Feb 26, 2021 at 10:00 AM Ian Lance Taylor <i...@golang.org> wrote: >> >> On Fri, Feb 26, 2021 at 6:11 AM Yan Titarenko >> <local.tourist.k...@gmail.com> wrote: >> > >> > CC'ing to committers. >> > >> > Ian, >> > please provide some advise. >> >> I'm sorry, I don't have anything useful to add beyond what I've already said. >> >> I don't know why people are using the reflect2 package. The package >> does not support gccgo/GoLLVM. The first step is to understand why >> people use reflect2, and whether we can improve the standard reflect >> package to address whatever problems led to the creation of reflect2. >> >> Ian >> >> >> > On Wed, Feb 24, 2021 at 2:00 PM Yan Titarenko >> > <local.tourist.k...@gmail.com> wrote: >> >> >> >> Hi. >> >> >> >> Since there where no comments on >> >> https://github.com/json-iterator/go/issues/501 - I decided that an open >> >> discussion (not necessarily on behalf of this project - there could be >> >> other projects/use cases, which could a cause for contributions, into the >> >> reflection library). >> >> >> >> I tried to test with Golang 1.15.8. I tried an old version of >> >> llvm-goc/gollvm - but can re-check, using the latest version of gollvm. >> >> Also hence that one of the checks was done on x86_64 Windows 10. >> >> >> >> It is not clear what kind of patch (and in favor of which engineering >> >> targets) would be required, yet - so we are not at the point where we >> >> could excavate OS/arch dependent issues. >> >> >> >> I see a lot of errors like >> >> >> >> ./any.go:259:15: undefined: "github.com/goccy/go-reflect".TypeOfPtr >> >> ./reflect_array.go:36:15: undefined: >> >> "github.com/goccy/go-reflect".UnsafeArrayType >> >> . >> >> I tried to do two things: I tried to revert back from reflect2 to libgo's >> >> reflect - and I tried to use goccy's go-reflect, instead of reflect2. >> >> It is interesting that both attempts brought similar errors - but they >> >> also brought some unique errors. >> >> But nothing that would bring specific practical wage, just case of that. >> >> >> >> Yan >> >> >> >> -- >> >> 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. >> >> To view this discussion on the web visit >> >> https://groups.google.com/d/msgid/golang-nuts/ab44891f-eca6-47cb-a4b1-c6292d6015a7n%40googlegroups.com. >> >> -- >> 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. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/golang-nuts/CAKOQZ8zbyemhzCd_1cEAkrc5FAwcdDOyo%3DxSBNafcA_mTpdYnQ%40mail.gmail.com. -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAOyqgcWFXW_kbXbXQ1XjN6XonPJO-zsA-fONNs96ObqRC63J3A%40mail.gmail.com.