Skip to content

Conversation

joamaki
Copy link
Contributor

@joamaki joamaki commented Jul 31, 2025

Update the README to include TableHeader() & TableRow() examples as a previous commit added the TableWritable constraint to NewTable().

Update the README to include TableHeader() & TableRow() examples as
a previous commit added the TableWritable constraint to NewTable().

Signed-off-by: Jussi Maki <jussi.maki@isovalent.com>
@joamaki joamaki requested a review from a team as a code owner July 31, 2025 14:38
@joamaki joamaki requested review from derailed and removed request for a team July 31, 2025 14:38
Copy link

$ make
go build ./...
go: downloading go1.24.0 (linux/amd64)
go: downloading go.yaml.in/yaml/v3 v3.0.3
go: downloading github.com/cilium/hive v0.0.0-20250522123230-2946c4940f41
go: downloading golang.org/x/time v0.5.0
go: downloading github.com/spf13/cobra v1.8.0
go: downloading github.com/spf13/pflag v1.0.5
go: downloading github.com/cilium/stream v0.0.0-20240209152734-a0792b51812d
go: downloading github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de
go: downloading github.com/spf13/viper v1.18.2
go: downloading go.uber.org/dig v1.17.1
go: downloading golang.org/x/term v0.16.0
go: downloading github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc
go: downloading github.com/go-viper/mapstructure/v2 v2.2.1
go: downloading golang.org/x/sys v0.17.0
go: downloading golang.org/x/tools v0.17.0
go: downloading github.com/spf13/cast v1.6.0
go: downloading github.com/fsnotify/fsnotify v1.7.0
go: downloading github.com/mitchellh/mapstructure v1.5.0
go: downloading github.com/sagikazarmark/slog-shim v0.1.0
go: downloading github.com/spf13/afero v1.11.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 gopkg.in/yaml.v3 v3.0.1
go: downloading golang.org/x/text v0.14.0
go test ./... -cover -vet=all -test.count 1
go: downloading github.com/stretchr/testify v1.8.4
go: downloading go.uber.org/goleak v1.3.0
go: downloading golang.org/x/exp v0.0.0-20240119083558-1b970713d09a
go: downloading github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2
ok  	github.com/cilium/statedb	22.997s	coverage: 83.5% of statements
ok  	github.com/cilium/statedb/index	0.010s	coverage: 28.7% of statements
ok  	github.com/cilium/statedb/internal	0.024s	coverage: 46.7% of statements
ok  	github.com/cilium/statedb/part	5.074s	coverage: 87.6% of statements
ok  	github.com/cilium/statedb/reconciler	0.247s	coverage: 89.7% of statements
	github.com/cilium/statedb/reconciler/benchmark		coverage: 0.0% of statements
	github.com/cilium/statedb/reconciler/example		coverage: 0.0% of statements
go test -race ./... -test.count 1
ok  	github.com/cilium/statedb	106.133s
ok  	github.com/cilium/statedb/index	1.014s
ok  	github.com/cilium/statedb/internal	1.026s
ok  	github.com/cilium/statedb/part	36.914s
ok  	github.com/cilium/statedb/reconciler	1.357s
?   	github.com/cilium/statedb/reconciler/benchmark	[no test files]
?   	github.com/cilium/statedb/reconciler/example	[no test files]
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                    	  517832	      2234 ns/op	    447635 objects/sec	    1416 B/op	      26 allocs/op
BenchmarkDB_WriteTxn_10-4                   	 1279836	       852.1 ns/op	   1173591 objects/sec	     481 B/op	       9 allocs/op
BenchmarkDB_WriteTxn_100-4                  	 1884021	       641.9 ns/op	   1557987 objects/sec	     400 B/op	       7 allocs/op
BenchmarkDB_WriteTxn_1000-4                 	 1744062	       682.7 ns/op	   1464821 objects/sec	     364 B/op	       7 allocs/op
BenchmarkDB_WriteTxn_100_SecondaryIndex-4   	  552542	      2031 ns/op	    492387 objects/sec	    1212 B/op	      37 allocs/op
BenchmarkDB_NewWriteTxn-4                   	 1492263	       803.0 ns/op	     544 B/op	       8 allocs/op
BenchmarkDB_NewReadTxn-4                    	482011281	         2.489 ns/op	       0 B/op	       0 allocs/op
BenchmarkDB_Modify-4                        	    1641	    745955 ns/op	   1340564 objects/sec	  422420 B/op	    8143 allocs/op
BenchmarkDB_GetInsert-4                     	    1489	    833411 ns/op	   1199888 objects/sec	  406429 B/op	    8142 allocs/op
BenchmarkDB_RandomInsert-4                  	    1741	    696929 ns/op	   1434865 objects/sec	  397570 B/op	    7141 allocs/op
BenchmarkDB_RandomReplace-4                 	     368	   3248747 ns/op	    307811 objects/sec	 1976140 B/op	   49161 allocs/op
BenchmarkDB_SequentialInsert-4              	    1846	    668850 ns/op	   1495105 objects/sec	  364022 B/op	    7114 allocs/op
BenchmarkDB_SequentialInsert_Prefix-4       	     400	   2991506 ns/op	    334280 objects/sec	 3718034 B/op	   58568 allocs/op
BenchmarkDB_Changes_Baseline-4              	    1398	    858469 ns/op	   1164864 objects/sec	  433539 B/op	   10214 allocs/op
BenchmarkDB_Changes-4                       	     808	   1504392 ns/op	    664720 objects/sec	  755851 B/op	   14420 allocs/op
BenchmarkDB_RandomLookup-4                  	   21721	     55466 ns/op	  18029199 objects/sec	       0 B/op	       0 allocs/op
BenchmarkDB_SequentialLookup-4              	   24673	     48648 ns/op	  20555876 objects/sec	       0 B/op	       0 allocs/op
BenchmarkDB_Prefix_SecondaryIndex-4         	    6918	    163710 ns/op	   6108368 objects/sec	  125114 B/op	    1031 allocs/op
BenchmarkDB_FullIteration_All-4             	    1054	   1094642 ns/op	  91354035 objects/sec	     320 B/op	      11 allocs/op
BenchmarkDB_FullIteration_Get-4             	     182	   6546042 ns/op	  15276406 objects/sec	       0 B/op	       0 allocs/op
BenchmarkDB_FullIteration_ReadTxnGet-4      	     183	   6554927 ns/op	  15255699 objects/sec	       0 B/op	       0 allocs/op
BenchmarkDB_PropagationDelay-4              	  518154	      2048 ns/op	        18.00 50th_µs	        22.00 90th_µs	        45.00 99th_µs	    1069 B/op	      22 allocs/op
BenchmarkWatchSet_4-4                       	 1297791	       923.3 ns/op	     499 B/op	       7 allocs/op
BenchmarkWatchSet_16-4                      	  503337	      2419 ns/op	    1699 B/op	       8 allocs/op
BenchmarkWatchSet_128-4                     	   61110	     19805 ns/op	   13359 B/op	       8 allocs/op
BenchmarkWatchSet_1024-4                    	    6352	    194308 ns/op	  105376 B/op	       8 allocs/op
PASS
ok  	github.com/cilium/statedb	33.688s
PASS
ok  	github.com/cilium/statedb/index	0.003s
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_Uint64Map_Random-4        	    1291	    896220 ns/op	   1115797 items/sec	 2811524 B/op	   11036 allocs/op
Benchmark_Uint64Map_Sequential-4    	    1422	    833967 ns/op	   1199088 items/sec	 2591252 B/op	   11749 allocs/op
Benchmark_Insert_RootOnlyWatch-4    	    9676	    121181 ns/op	   8252124 objects/sec	   74537 B/op	    2044 allocs/op
Benchmark_Insert-4                  	    6945	    176541 ns/op	   5664402 objects/sec	  190510 B/op	    3076 allocs/op
Benchmark_Modify-4                  	   10000	    100185 ns/op	   9981553 objects/sec	   72141 B/op	    1028 allocs/op
Benchmark_GetInsert-4               	    8414	    143672 ns/op	   6960288 objects/sec	   72051 B/op	    1028 allocs/op
Benchmark_Replace-4                 	27549742	        43.04 ns/op	  23231822 objects/sec	       0 B/op	       0 allocs/op
Benchmark_Replace_RootOnlyWatch-4   	27830562	        43.70 ns/op	  22882220 objects/sec	       0 B/op	       0 allocs/op
Benchmark_txn_1-4                   	 3237409	       372.0 ns/op	   2687981 objects/sec	     280 B/op	       5 allocs/op
Benchmark_txn_10-4                  	 8393748	       141.1 ns/op	   7086444 objects/sec	      97 B/op	       2 allocs/op
Benchmark_txn_100-4                 	10308066	       115.4 ns/op	   8662271 objects/sec	      91 B/op	       2 allocs/op
Benchmark_txn_1000-4                	 9415743	       126.5 ns/op	   7902715 objects/sec	      78 B/op	       2 allocs/op
Benchmark_txn_delete_1-4            	 1542511	       781.1 ns/op	   1280227 objects/sec	    3272 B/op	       8 allocs/op
Benchmark_txn_delete_10-4           	 7127008	       166.6 ns/op	   6004091 objects/sec	     368 B/op	       2 allocs/op
Benchmark_txn_delete_100-4          	10901239	       109.6 ns/op	   9120841 objects/sec	      82 B/op	       1 allocs/op
Benchmark_txn_delete_1000-4         	11591688	       103.1 ns/op	   9701660 objects/sec	      28 B/op	       1 allocs/op
Benchmark_Get-4                     	   34125	     35551 ns/op	  28128366 objects/sec	       0 B/op	       0 allocs/op
Benchmark_Iterate-4                 	  169712	      7352 ns/op	 136024238 objects/sec	     104 B/op	       4 allocs/op
Benchmark_Hashmap_Insert-4          	   14828	     80865 ns/op	  12366359 objects/sec	   74265 B/op	      20 allocs/op
Benchmark_Hashmap_Get_Uint64-4      	  137792	      8661 ns/op	 115455614 objects/sec	       0 B/op	       0 allocs/op
Benchmark_Hashmap_Get_Bytes-4       	  110317	     10868 ns/op	  92017377 objects/sec	       0 B/op	       0 allocs/op
PASS
ok  	github.com/cilium/statedb/part	26.937s
PASS
ok  	github.com/cilium/statedb/reconciler	0.004s
?   	github.com/cilium/statedb/reconciler/benchmark	[no test files]
?   	github.com/cilium/statedb/reconciler/example	[no test files]
go run ./reconciler/benchmark -quiet
1000000 objects reconciled in 2.53 seconds (batch size 1000)
Throughput 395657.30 objects per second
1167MB total allocated, 6011130 in-use objects, 353MB bytes in use

@joamaki joamaki merged commit 5f6e8d6 into main Jul 31, 2025
1 check passed
@joamaki joamaki deleted the pr/joamaki/update-readme-tablewritable branch July 31, 2025 15:50
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