Skip to content

Commit

Permalink
Update convert.go
Browse files Browse the repository at this point in the history
  • Loading branch information
ReneWerner87 authored Feb 12, 2024
1 parent 14ab51b commit ee89d2a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
// UnsafeString returns a string pointer without allocation
func UnsafeString(b []byte) string {
// the new way is slower `return unsafe.String(unsafe.SliceData(b), len(b))`
// unsafe.Pointer variant: 0.5410 ns/op vs unsafe.String variant: 0.3538 ns/op
// unsafe.Pointer variant: 0.3538 ns/op vs unsafe.String variant: 0.5410 ns/op
return *(*string)(unsafe.Pointer(&b))
}

Expand Down

0 comments on commit ee89d2a

Please sign in to comment.