Git Product home page Git Product logo

Comments (6)

Aden-Q avatar Aden-Q commented on May 28, 2024 1

@nikzayn of course

from kubernetes.

k8s-ci-robot avatar k8s-ci-robot commented on May 28, 2024

This issue is currently awaiting triage.

If a SIG or subproject determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

from kubernetes.

pranav-pandey0804 avatar pranav-pandey0804 commented on May 28, 2024

/sig api-machinery

from kubernetes.

cyclinder avatar cyclinder commented on May 28, 2024

Good catch! Why should we use unsafe packages before?

from kubernetes.

Aden-Q avatar Aden-Q commented on May 28, 2024

@cyclinder For string to bytes conversion, before go 1.22, type casting is not 0 memory allocation, and indeed is slower than the unsafe way:
go 1.21 (or before):

╰─± go test -run=xxx -bench=.  ./...
goos: darwin
goarch: amd64
pkg: github.com/josestg/zerocast
cpu: Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
BenchmarkStringToBytesTypeCasting-10                    7207893               151.1 ns/op          1792 B/op          1 allocs/op
BenchmarkStringToBytesUnsafe-10               1000000000               0.3904 ns/op          0 B/op          0 allocs/op

but not the case for go 1.22, type casting is 0 memory allocation now, faster and safer:

╰─± go test -run=xxx -bench=.  ./...
goos: darwin
goarch: amd64
pkg: github.com/josestg/zerocast
cpu: Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
BenchmarkStringToBytesTypeCasting-12    	                1000000000	         0.2581 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringToBytesUnsafe-12            	1000000000	         0.4422 ns/op	       0 B/op	       0 allocs/op

from kubernetes.

nikzayn avatar nikzayn commented on May 28, 2024

@Aden-Q Can I take this up thanks for the valuable description. I explored something good today. Thanks.

/assign

from kubernetes.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.