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

index: Add missing integer indexers #21

Merged
merged 1 commit into from
Apr 25, 2024
Merged

Conversation

joamaki
Copy link
Contributor

@joamaki joamaki commented Apr 25, 2024

Add the missing integer indexers and simplify all by using Append*.

Add the missing integer indexers and simplify all by
using Append*.

Signed-off-by: Jussi Maki <[email protected]>
@joamaki joamaki requested a review from bimmlerd April 25, 2024 14:13
Copy link

$ make test
go: downloading github.com/mitchellh/mapstructure v1.5.0
go: downloading golang.org/x/term v0.16.0
go: downloading github.com/fsnotify/fsnotify v1.7.0
go: downloading github.com/sagikazarmark/slog-shim v0.1.0
go: downloading github.com/spf13/afero v1.11.0
go: downloading github.com/spf13/cast v1.6.0
go: downloading golang.org/x/sys v0.17.0
go: downloading github.com/subosito/gotenv v1.6.0
go: downloading github.com/hashicorp/hcl v1.0.0
go: downloading gopkg.in/ini.v1 v1.67.0
go: downloading github.com/magiconair/properties v1.8.7
go: downloading github.com/pelletier/go-toml/v2 v2.1.0
go: downloading golang.org/x/text v0.14.0
	github.com/cilium/statedb/reconciler/benchmark		coverage: 0.0% of statements
	github.com/cilium/statedb/reconciler/example		coverage: 0.0% of statements
ok  	github.com/cilium/statedb	4.811s	coverage: 87.5% of statements
ok  	github.com/cilium/statedb/index	0.004s	coverage: 31.1% of statements
ok  	github.com/cilium/statedb/internal	0.010s	coverage: 93.3% of statements
ok  	github.com/cilium/statedb/part	1.206s	coverage: 87.8% of statements
ok  	github.com/cilium/statedb/reconciler	0.610s	coverage: 89.9% of statements
-----
$ make bench
go test ./... -bench . -benchmem -test.run xxx
goos: linux
goarch: amd64
pkg: github.com/cilium/statedb
cpu: AMD EPYC 7763 64-Core Processor                
BenchmarkDB_WriteTxn_1-4                    	  530596	      2312 ns/op	    432555 objects/sec	    2600 B/op	      31 allocs/op
BenchmarkDB_WriteTxn_10-4                   	 1302624	       874.8 ns/op	   1143086 objects/sec	     681 B/op	      10 allocs/op
BenchmarkDB_WriteTxn_100-4                  	 1762243	       684.4 ns/op	   1461208 objects/sec	     575 B/op	       7 allocs/op
BenchmarkDB_WriteTxn_1000-4                 	 1651500	       725.3 ns/op	   1378780 objects/sec	     543 B/op	       7 allocs/op
BenchmarkDB_WriteTxn_10000-4                	 1350386	       896.6 ns/op	   1115283 objects/sec	     596 B/op	       7 allocs/op
BenchmarkDB_WriteTxn_100_SecondaryIndex-4   	  895143	      1333 ns/op	    750063 objects/sec	     970 B/op	      15 allocs/op
BenchmarkDB_RandomInsert-4                  	    2493	    466022 ns/op	   2145820 objects/sec	  423236 B/op	    7153 allocs/op
BenchmarkDB_RandomReplace-4                 	     726	   1652411 ns/op	    605176 objects/sec	 1155063 B/op	   16506 allocs/op
BenchmarkDB_SequentialInsert-4              	    1712	    730805 ns/op	   1368354 objects/sec	  543181 B/op	    7221 allocs/op
BenchmarkDB_Changes_Baseline-4              	    1306	    897891 ns/op	   1113722 objects/sec	  582970 B/op	   10301 allocs/op
BenchmarkDB_Changes-4                       	     716	   1649952 ns/op	    606078 objects/sec	 1041041 B/op	   14646 allocs/op
BenchmarkDB_RandomLookup-4                  	   24739	     49263 ns/op	  20299384 objects/sec	     144 B/op	       1 allocs/op
BenchmarkDB_SequentialLookup-4              	   30738	     39439 ns/op	  25355689 objects/sec	       0 B/op	       0 allocs/op
BenchmarkDB_FullIteration_All-4             	     865	   1391827 ns/op	  71848160 objects/sec	     360 B/op	       7 allocs/op
BenchmarkDB_FullIteration_Get-4             	     243	   4861142 ns/op	  20571335 objects/sec	       0 B/op	       0 allocs/op
BenchmarkDB_PropagationDelay-4              	  522382	      2066 ns/op	        18.00 50th_µs	        21.00 90th_µs	        82.00 99th_µs	    1439 B/op	      23 allocs/op
PASS
ok  	github.com/cilium/statedb	25.434s
PASS
ok  	github.com/cilium/statedb/index	0.004s
PASS
ok  	github.com/cilium/statedb/internal	0.003s
goos: linux
goarch: amd64
pkg: github.com/cilium/statedb/part
cpu: AMD EPYC 7763 64-Core Processor                
Benchmark_Insert_RootOnlyWatch-4    	    9264	    122536 ns/op	   8160870 objects/sec	  119104 B/op	    2067 allocs/op
Benchmark_Insert-4                  	    6978	    170730 ns/op	   5857216 objects/sec	  219614 B/op	    3105 allocs/op
Benchmark_Replace-4                 	47719894	        25.14 ns/op	  39773765 objects/sec	       0 B/op	       0 allocs/op
Benchmark_Replace_RootOnlyWatch-4   	46585112	        25.11 ns/op	  39827158 objects/sec	       0 B/op	       0 allocs/op
Benchmark_txn_1-4                   	 3812241	       325.6 ns/op	   3070916 objects/sec	     336 B/op	       6 allocs/op
Benchmark_txn_10-4                  	 9003589	       132.2 ns/op	   7564746 objects/sec	     142 B/op	       2 allocs/op
Benchmark_txn_100-4                 	 8833093	       138.5 ns/op	   7222383 objects/sec	     211 B/op	       2 allocs/op
Benchmark_txn_1000-4                	 8644692	       138.2 ns/op	   7235813 objects/sec	     211 B/op	       2 allocs/op
Benchmark_txn_10000-4               	 5565459	       216.3 ns/op	   4623981 objects/sec	     224 B/op	       2 allocs/op
Benchmark_txn_100000-4              	 4160146	       265.2 ns/op	   3771123 objects/sec	     335 B/op	       2 allocs/op
Benchmark_txn_delete_1-4            	 3733228	       319.4 ns/op	   3130981 objects/sec	     840 B/op	       6 allocs/op
Benchmark_txn_delete_10-4           	10431166	       114.7 ns/op	   8721590 objects/sec	     129 B/op	       1 allocs/op
Benchmark_txn_delete_100-4          	13079502	        91.48 ns/op	  10931492 objects/sec	      61 B/op	       1 allocs/op
Benchmark_txn_delete_1000-4         	14524563	        82.45 ns/op	  12127980 objects/sec	      26 B/op	       1 allocs/op
Benchmark_txn_delete_10000-4        	11617999	       101.8 ns/op	   9822058 objects/sec	      25 B/op	       1 allocs/op
Benchmark_txn_delete_100000-4       	10033552	       110.4 ns/op	   9061023 objects/sec	      26 B/op	       1 allocs/op
Benchmark_Get-4                     	   50340	     24813 ns/op	  40301703 objects/sec	       0 B/op	       0 allocs/op
Benchmark_Iterate-4                 	  167383	      7342 ns/op	 136210695 objects/sec	      80 B/op	       3 allocs/op
Benchmark_Hashmap_Insert-4          	   15630	     76905 ns/op	  13003102 objects/sec	   86552 B/op	      64 allocs/op
Benchmark_Hashmap_Get_Uint64-4      	  153154	      7764 ns/op	 128802054 objects/sec	       0 B/op	       0 allocs/op
Benchmark_Hashmap_Get_Bytes-4       	  154455	      7804 ns/op	 128147669 objects/sec	       0 B/op	       0 allocs/op
PASS
ok  	github.com/cilium/statedb/part	29.538s
PASS
ok  	github.com/cilium/statedb/reconciler	0.005s
?   	github.com/cilium/statedb/reconciler/benchmark	[no test files]
?   	github.com/cilium/statedb/reconciler/example	[no test files]
go run ./reconciler/benchmark -quiet
100000 objects reconciled in 0.26 seconds (batch size 1000)
Throughput 384147.45 objects per second
Allocated 600533 objects, 40870kB bytes, 49896kB bytes still in use

@joamaki joamaki merged commit 628270b into main Apr 25, 2024
1 check passed
@joamaki joamaki deleted the pr/joamaki/add-uint32-index branch April 25, 2024 14:21
Copy link
Member

@bimmlerd bimmlerd left a comment

Choose a reason for hiding this comment

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

lgtm ;)

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.

2 participants