It's not even worth calling bytes.Equal to see if a bunch of bytes is zero.
A more efficient way would be to simply loop over them and check for
non-zero.

-- Marcin

On Sat, Nov 16, 2019 at 4:00 PM Kevin Malachowski <niftasti...@gmail.com>
wrote:

> "make"ing a byre slice every time you call Equal is not likely as
> efficient; surely it will put pressure on the garbage collector, assuming
> it's not just called a few times.
>
> Writing something in less lines is not strictly better. I'd probably just
> make package level variable and reuse it among multiple calls to that
> function.
>
> --
> 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/9cfa25b8-4a18-47ca-9f37-5d5ae5b71849%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/CA%2Bv29Lv4k28kM1Yc7wTyGzeRVxJa9dxFjwGKQZ3NhYTsufDvmw%40mail.gmail.com.

Reply via email to