Skip to content

πŸ§‘β€πŸ’» ToString: improve test and bench setup#63

Merged
ReneWerner87 merged 4 commits intomasterfrom
maintenanceToString
Feb 9, 2024
Merged

πŸ§‘β€πŸ’» ToString: improve test and bench setup#63
ReneWerner87 merged 4 commits intomasterfrom
maintenanceToString

Conversation

@ReneWerner87
Copy link
Member

  • add string slice case
  • add parallel instruction for child tests
  • benchmark table and parallel execution

- add string slice case
- add parallel instruction for child tests
- benchmark table and parallel execution
@ReneWerner87
Copy link
Member Author

ReneWerner87 commented Feb 9, 2024

before:
image
after:
image

@ReneWerner87
Copy link
Member Author

before:

Benchmark_ToString/[]string-12         	27281485	        37.12 ns/op	      48 B/op	       3 allocs/op
Benchmark_ToString/[]string-12         	28435568	        39.74 ns/op	      48 B/op	       3 allocs/op
Benchmark_ToString/[]int-12            	36790112	        33.60 ns/op	      24 B/op	       3 allocs/op
Benchmark_ToString/[]int-12            	32494309	        34.20 ns/op	      24 B/op	       3 allocs/op
Benchmark_ToString/[]interface_{}-12   	 8995060	       116.0 ns/op	      96 B/op	       5 allocs/op
Benchmark_ToString/[]interface_{}-12   	 9844160	       114.4 ns/op	      96 B/op	       5 allocs/op

after (more allocs but faster):
string builder

Benchmark_ToString/[]string-12         	45700502	        27.50 ns/op	      56 B/op	       4 allocs/op
Benchmark_ToString/[]string-12         	38168848	        29.37 ns/op	      56 B/op	       4 allocs/op
Benchmark_ToString/[]int-12            	94002447	        13.11 ns/op	      24 B/op	       3 allocs/op
Benchmark_ToString/[]int-12            	94167500	        13.67 ns/op	      24 B/op	       3 allocs/op
Benchmark_ToString/[]interface_{}-12   	11595938	       103.8 ns/op	     200 B/op	      11 allocs/op
Benchmark_ToString/[]interface_{}-12   	11507626	        99.74 ns/op	     200 B/op	      11 allocs/op

also tested with bytebufferpool

Benchmark_ToString/[]string-12         	14074546	        86.84 ns/op	      48 B/op	       3 allocs/op
Benchmark_ToString/[]string-12         	12282381	        85.03 ns/op	      48 B/op	       3 allocs/op
Benchmark_ToString/[]int-12            	15034382	        81.10 ns/op	      24 B/op	       3 allocs/op
Benchmark_ToString/[]int-12            	15246968	        81.95 ns/op	      24 B/op	       3 allocs/op
Benchmark_ToString/[]interface_{}-12   	 4522510	       273.1 ns/op	     120 B/op	       7 allocs/op
Benchmark_ToString/[]interface_{}-12   	 4322280	       274.7 ns/op	     120 B/op	       7 allocs/op

Copy link
Member

@gaby gaby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM so far

Copy link
Member

@gaby gaby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ReneWerner87 ReneWerner87 merged commit 2489b48 into master Feb 9, 2024
@efectn efectn deleted the maintenanceToString branch February 9, 2024 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants