The unique package itself has a few benchmarks <https://cs.opensource.google/go/go/+/master:src/unique/handle_bench_test.go;l=1;drc=a088e230d4e7892b15851babe161bbd1766738a1> you can run if you'd like, though they're somewhat limited. They exist primarily to validate that the implementation has generally good performance (that is, no obvious outliers or scaling issues).
Note that performance-wise one of the biggest things the unique package has going for it is efficient reclamation of memory. If an interned value is no longer referenced via a handle, its memory will be reclaimed in the next GC cycle. This is difficult to do with a regular map because it's not really clear when one should delete map entries. In terms of lookup/insertion/etc., I would expect unique.Make to perform much better than a locked map when doing operations in parallel, but perform slightly worse when everything is done on a single core. The underlying concurrent map implementation scales well to many cores in my testing. On Tuesday, June 25, 2024 at 4:58:17 PM UTC-4 Juliusz Chroboczek wrote: > Hi, > > Does anyone have any benchmarks for the new "unique" package? How does > it compare with manual interning using a map? > > Thanks. > > -- 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/7f5510e4-439a-4b9b-afb2-93231a9838e9n%40googlegroups.com.