Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use runtime.mallocgc to make bytes without clear memory #209

Merged

Conversation

jayantxie
Copy link
Collaborator

No description provided.

@jayantxie jayantxie force-pushed the perf/optimize_make_bytes branch from 6274f8a to ea7c7aa Compare March 27, 2024 12:01
@jayantxie jayantxie changed the title Perf/optimize make bytes feat: use runtime.rawstring to make bytes without clear memory Mar 27, 2024
@jayantxie jayantxie force-pushed the perf/optimize_make_bytes branch 2 times, most recently from b2b2db7 to 435b41b Compare March 27, 2024 12:19
@jayantxie
Copy link
Collaborator Author

jayantxie commented Mar 27, 2024

tiger@xxx:~/xiezhengyao/github.com/jayantxie/gopkg/lang/dirtmake$ GOMAXPROCS=1 GOGC=1000 go test -v -bench=. -benchmem -benchtime=5s
goos: linux
goarch: amd64
pkg: github.com/bytedance/gopkg/lang/dirtmake
cpu: Intel(R) Xeon(R) Gold 5118 CPU @ 2.30GHz
BenchmarkFastMake
BenchmarkFastMake/size=1024
BenchmarkFastMake/size=1024         	75632510	        80.88 ns/op	    1024 B/op	       1 allocs/op
BenchmarkFastMake/size=3072
BenchmarkFastMake/size=3072         	56139994	       104.1 ns/op	    3072 B/op	       1 allocs/op
BenchmarkFastMake/size=5120
BenchmarkFastMake/size=5120         	25204423	       213.5 ns/op	    5376 B/op	       1 allocs/op
BenchmarkFastMake/size=7168
BenchmarkFastMake/size=7168         	12370452	       498.2 ns/op	    8192 B/op	       1 allocs/op
BenchmarkFastMake/size=9216
BenchmarkFastMake/size=9216         	35381056	       177.0 ns/op	    9472 B/op	       1 allocs/op
BenchmarkFastMake/size=11264
BenchmarkFastMake/size=11264        	15790495	       371.2 ns/op	   12288 B/op	       1 allocs/op
BenchmarkFastMake/size=13312
BenchmarkFastMake/size=13312        	24623552	       282.5 ns/op	   13568 B/op	       1 allocs/op
BenchmarkFastMake/size=15360
BenchmarkFastMake/size=15360        	 8764629	       650.0 ns/op	   16384 B/op	       1 allocs/op
BenchmarkFastMake/size=17408
BenchmarkFastMake/size=17408        	21286158	       324.7 ns/op	   18432 B/op	       1 allocs/op
BenchmarkFastMake/size=19456
BenchmarkFastMake/size=19456        	15668707	       420.1 ns/op	   20480 B/op	       1 allocs/op
BenchmarkOriginMake
BenchmarkOriginMake/size=1024
BenchmarkOriginMake/size=1024       	27477183	       207.9 ns/op	    1024 B/op	       1 allocs/op
BenchmarkOriginMake/size=3072
BenchmarkOriginMake/size=3072       	 7992910	       742.3 ns/op	    3072 B/op	       1 allocs/op
BenchmarkOriginMake/size=5120
BenchmarkOriginMake/size=5120       	 4515583	      1307 ns/op	    5376 B/op	       1 allocs/op
BenchmarkOriginMake/size=7168
BenchmarkOriginMake/size=7168       	 2712064	      2203 ns/op	    8192 B/op	       1 allocs/op
BenchmarkOriginMake/size=9216
BenchmarkOriginMake/size=9216       	 3215642	      1868 ns/op	    9472 B/op	       1 allocs/op
BenchmarkOriginMake/size=11264
BenchmarkOriginMake/size=11264      	 2260072	      2579 ns/op	   12288 B/op	       1 allocs/op
BenchmarkOriginMake/size=13312
BenchmarkOriginMake/size=13312      	 2234844	      2655 ns/op	   13568 B/op	       1 allocs/op
BenchmarkOriginMake/size=15360
BenchmarkOriginMake/size=15360      	 1659430	      3624 ns/op	   16384 B/op	       1 allocs/op
BenchmarkOriginMake/size=17408
BenchmarkOriginMake/size=17408      	 1748785	      3348 ns/op	   18432 B/op	       1 allocs/op
BenchmarkOriginMake/size=19456
BenchmarkOriginMake/size=19456      	 1513047	      3991 ns/op	   20480 B/op	       1 allocs/op
PASS
ok  	github.com/bytedance/gopkg/lang/dirtmake	151.884s

@jayantxie jayantxie force-pushed the perf/optimize_make_bytes branch from 435b41b to bf64321 Compare March 28, 2024 06:41
@jayantxie jayantxie requested a review from kaka19ace as a code owner March 28, 2024 06:41
@jayantxie jayantxie force-pushed the perf/optimize_make_bytes branch 3 times, most recently from c23adb8 to 4974474 Compare March 29, 2024 10:37
joway
joway previously approved these changes May 7, 2024
@jayantxie jayantxie changed the title feat: use runtime.rawstring to make bytes without clear memory feat: use runtime.mallocgc to make bytes without clear memory May 7, 2024
@jayantxie jayantxie force-pushed the perf/optimize_make_bytes branch from 4974474 to 72f7976 Compare May 7, 2024 02:42
joway
joway previously approved these changes May 7, 2024
PureWhiteWu
PureWhiteWu previously approved these changes May 7, 2024
lang/dirtmake/bytes.go Show resolved Hide resolved
lang/dirtmake/bytes_test.go Show resolved Hide resolved
@jayantxie jayantxie dismissed stale reviews from PureWhiteWu and joway via ef65497 May 7, 2024 05:36
@jayantxie jayantxie force-pushed the perf/optimize_make_bytes branch from 72f7976 to ef65497 Compare May 7, 2024 05:36
@zhangyunhao116 zhangyunhao116 merged commit 197ded9 into bytedance:develop May 7, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants