This is an automated email from the git hooks/post-receive script.

meskio pushed a commit to branch main
in repository pluggable-transports/snowflake.

commit 6bae31f07782776fb4c289dec6f7e10233609eef
Author: David Fifield <[email protected]>
AuthorDate: Tue Apr 4 16:56:46 2023 -0600

    Use a static array in benchmarks.
    
    Since d2858aeb7ec50ae09b9a7e2e2a910ae31cec62bd the caller is permitted
    to reuse its slice again.
---
 common/turbotunnel/queuepacketconn_test.go | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/common/turbotunnel/queuepacketconn_test.go 
b/common/turbotunnel/queuepacketconn_test.go
index e7eb90f..2bb4eeb 100644
--- a/common/turbotunnel/queuepacketconn_test.go
+++ b/common/turbotunnel/queuepacketconn_test.go
@@ -27,12 +27,9 @@ func BenchmarkQueueIncoming(b *testing.B) {
        defer conn.Close()
 
        b.ResetTimer()
-       s := 500
+       var p [500]byte
        for i := 0; i < b.N; i++ {
-               // Use a variable for the length to stop the compiler from
-               // optimizing out the allocation.
-               p := make([]byte, s)
-               conn.QueueIncoming(p, emptyAddr{})
+               conn.QueueIncoming(p[:], emptyAddr{})
        }
        b.StopTimer()
 }
@@ -43,12 +40,9 @@ func BenchmarkWriteTo(b *testing.B) {
        defer conn.Close()
 
        b.ResetTimer()
-       s := 500
+       var p [500]byte
        for i := 0; i < b.N; i++ {
-               // Use a variable for the length to stop the compiler from
-               // optimizing out the allocation.
-               p := make([]byte, s)
-               conn.WriteTo(p, emptyAddr{})
+               conn.WriteTo(p[:], emptyAddr{})
        }
        b.StopTimer()
 }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.
_______________________________________________
tor-commits mailing list
[email protected]
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits

Reply via email to