Skip to content

Reduce number of copy operations in Decode#4

Open
karaketir16 wants to merge 1 commit into
maruel:mainfrom
karaketir16:copyless
Open

Reduce number of copy operations in Decode#4
karaketir16 wants to merge 1 commit into
maruel:mainfrom
karaketir16:copyless

Conversation

@karaketir16

Copy link
Copy Markdown

DecodeSingle gets a single slice, data combined with ecc. If possible, using this function instead of Decode reduces the memory usage and allocation.

goos: linux
goarch: amd64
pkg: github.com/maruel/rs
cpu: 12th Gen Intel(R) Core(TM) i5-12450H
BenchmarkDecode16_10-12                     	 2507281	       479.0 ns/op	83751332.47 MB/s	      48 B/op	       2 allocs/op
BenchmarkDecodeSingle16_10-12               	 2553074	       457.3 ns/op	89333181.87 MB/s	      16 B/op	       1 allocs/op
BenchmarkDecode16_10With1Error-12           	 1266762	      1037 ns/op	19535895.82 MB/s	     512 B/op	      27 allocs/op
BenchmarkDecodeSingle16_10With1Error-12     	 1000000	      1006 ns/op	15899815.31 MB/s	     480 B/op	      26 allocs/op
BenchmarkDecode128_16-12                    	  200122	      6170 ns/op	4151483.66 MB/s	     160 B/op	       2 allocs/op
BenchmarkDecodeSingle128_16-12              	  202068	      6001 ns/op	4309959.18 MB/s	      16 B/op	       1 allocs/op
BenchmarkDecode128_16With1Error-12          	  178846	      6609 ns/op	3463615.24 MB/s	     662 B/op	      27 allocs/op
BenchmarkDecodeSingle128_16With1Error-12    	  180782	      6521 ns/op	3548558.03 MB/s	     518 B/op	      26 allocs/op
BenchmarkDecode128_16With2Error-12          	  163591	      7252 ns/op	2887260.40 MB/s	    1032 B/op	      45 allocs/op
BenchmarkDecodeSingle128_16With2Error-12    	  164965	      7267 ns/op	2905602.99 MB/s	     888 B/op	      44 allocs/op
PASS
ok  	github.com/maruel/rs	14.251s

@karaketir16

Copy link
Copy Markdown
Author

As I said in #3 (comment), I can not modify the poly. I am keeping two functions for now.

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.

1 participant