Skip to content

Conversation

@joamaki
Copy link
Contributor

@joamaki joamaki commented Dec 19, 2025

Experimenting with a TUI for inspecting StateDB.

statedb-tui.mov

@github-actions
Copy link

github-actions bot commented Dec 19, 2025

$ 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-20251219070844-89ccf807d9fb
go: downloading golang.org/x/time v0.5.0
go: downloading github.com/gdamore/tcell/v2 v2.13.4
go: downloading github.com/rivo/tview v0.42.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/gdamore/encoding v1.0.1
go: downloading github.com/lucasb-eyer/go-colorful v1.3.0
go: downloading github.com/rivo/uniseg v0.4.7
go: downloading golang.org/x/sys v0.38.0
go: downloading golang.org/x/term v0.37.0
go: downloading golang.org/x/text v0.31.0
go: downloading github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc
go: downloading github.com/mitchellh/mapstructure v1.5.0
go: downloading go.uber.org/dig v1.17.1
go: downloading github.com/spf13/viper v1.18.2
go: downloading golang.org/x/tools v0.38.0
go: downloading github.com/spf13/cast v1.6.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/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
PART_VALIDATE=1 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	165.403s	coverage: 81.2% of statements
	github.com/cilium/statedb/cmd/tui		coverage: 0.0% of statements
ok  	github.com/cilium/statedb/index	0.005s	coverage: 28.7% of statements
ok  	github.com/cilium/statedb/internal	0.013s	coverage: 42.9% of statements
ok  	github.com/cilium/statedb/part	100.238s	coverage: 88.0% of statements
ok  	github.com/cilium/statedb/reconciler	0.347s	coverage: 89.1% of statements
	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/tui	0.003s	coverage: 15.3% of statements
go test -race ./... -test.count 1
ok  	github.com/cilium/statedb	38.628s
?   	github.com/cilium/statedb/cmd/tui	[no test files]
ok  	github.com/cilium/statedb/index	1.016s
ok  	github.com/cilium/statedb/internal	1.033s
ok  	github.com/cilium/statedb/part	33.898s
ok  	github.com/cilium/statedb/reconciler	1.307s
?   	github.com/cilium/statedb/reconciler/benchmark	[no test files]
?   	github.com/cilium/statedb/reconciler/example	[no test files]
ok  	github.com/cilium/statedb/tui	1.025s
go test ./... -bench . -benchmem -test.run xxx
goos: linux
goarch: amd64
pkg: github.com/cilium/statedb
cpu: Intel(R) Xeon(R) Platinum 8370C CPU @ 2.80GHz
BenchmarkDB_WriteTxn_1-4                    	  636301	      1828 ns/op	    547104 objects/sec	    1072 B/op	      18 allocs/op
BenchmarkDB_WriteTxn_10-4                   	 1597690	       760.1 ns/op	   1315662 objects/sec	     455 B/op	       8 allocs/op
BenchmarkDB_WriteTxn_100-4                  	 2008012	       622.9 ns/op	   1605298 objects/sec	     424 B/op	       7 allocs/op
BenchmarkDB_WriteTxn_1000-4                 	 1813692	       656.6 ns/op	   1522993 objects/sec	     373 B/op	       7 allocs/op
BenchmarkDB_WriteTxn_100_SecondaryIndex-4   	  586874	      1984 ns/op	    504035 objects/sec	    1242 B/op	      37 allocs/op
BenchmarkDB_NewWriteTxn-4                   	 1818914	       652.0 ns/op	     312 B/op	       3 allocs/op
BenchmarkDB_NewReadTxn-4                    	751529163	         1.583 ns/op	       0 B/op	       0 allocs/op
BenchmarkDB_Modify-4                        	    1628	    721192 ns/op	   1386593 objects/sec	  425262 B/op	    8109 allocs/op
BenchmarkDB_GetInsert-4                     	    1474	    790667 ns/op	   1264755 objects/sec	  385298 B/op	    8110 allocs/op
BenchmarkDB_RandomInsert-4                  	    1735	    677588 ns/op	   1475824 objects/sec	  377311 B/op	    7110 allocs/op
BenchmarkDB_RandomReplace-4                 	     385	   3073168 ns/op	    325397 objects/sec	 1718971 B/op	   46174 allocs/op
BenchmarkDB_SequentialInsert-4              	    1879	    635037 ns/op	   1574711 objects/sec	  373845 B/op	    7108 allocs/op
BenchmarkDB_SequentialInsert_Prefix-4       	     430	   2817876 ns/op	    354877 objects/sec	 3497528 B/op	   56552 allocs/op
BenchmarkDB_Changes_Baseline-4              	    1398	    861341 ns/op	   1160981 objects/sec	  480063 B/op	   10214 allocs/op
BenchmarkDB_Changes-4                       	     765	   1542261 ns/op	    648399 objects/sec	  797210 B/op	   14394 allocs/op
BenchmarkDB_RandomLookup-4                  	   19789	     60786 ns/op	  16451193 objects/sec	       0 B/op	       0 allocs/op
BenchmarkDB_SequentialLookup-4              	   25155	     47691 ns/op	  20968378 objects/sec	       0 B/op	       0 allocs/op
BenchmarkDB_Prefix_SecondaryIndex-4         	    8272	    144430 ns/op	   6923780 objects/sec	  125114 B/op	    1031 allocs/op
BenchmarkDB_FullIteration_All-4             	    1052	   1131147 ns/op	  88405866 objects/sec	     320 B/op	      11 allocs/op
BenchmarkDB_FullIteration_Get-4             	     166	   7145881 ns/op	  13994075 objects/sec	       0 B/op	       0 allocs/op
BenchmarkDB_FullIteration_Get_Secondary-4   	      86	  12663358 ns/op	   7896800 objects/sec	       0 B/op	       0 allocs/op
BenchmarkDB_FullIteration_ReadTxnGet-4      	     195	   6122168 ns/op	  16334084 objects/sec	       0 B/op	       0 allocs/op
BenchmarkDB_PropagationDelay-4              	  637452	      1739 ns/op	        15.00 50th_µs	        18.00 90th_µs	        41.00 99th_µs	    1016 B/op	      20 allocs/op
BenchmarkWatchSet_4-4                       	 2179417	       549.9 ns/op	     320 B/op	       5 allocs/op
BenchmarkWatchSet_16-4                      	  721178	      1673 ns/op	    1096 B/op	       5 allocs/op
BenchmarkWatchSet_128-4                     	   83463	     14616 ns/op	    8904 B/op	       5 allocs/op
BenchmarkWatchSet_1024-4                    	    8353	    138984 ns/op	   73745 B/op	       5 allocs/op
PASS
ok  	github.com/cilium/statedb	34.749s
?   	github.com/cilium/statedb/cmd/tui	[no test files]
PASS
ok  	github.com/cilium/statedb/index	0.004s
goos: linux
goarch: amd64
pkg: github.com/cilium/statedb/internal
cpu: Intel(R) Xeon(R) Platinum 8370C CPU @ 2.80GHz
Benchmark_SortableMutex-4   	 8428650	       142.3 ns/op	       0 B/op	       0 allocs/op
PASS
ok  	github.com/cilium/statedb/internal	1.204s
goos: linux
goarch: amd64
pkg: github.com/cilium/statedb/part
cpu: Intel(R) Xeon(R) Platinum 8370C CPU @ 2.80GHz
Benchmark_Uint64Map_Random-4                  	    1408	    808819 ns/op	   1236370 items/sec	 2569490 B/op	    7038 allocs/op
Benchmark_Uint64Map_Sequential-4              	    1760	    690037 ns/op	   1449198 items/sec	 2266259 B/op	    6755 allocs/op
Benchmark_Uint64Map_Sequential_Insert-4       	    1936	    619547 ns/op	   1614083 items/sec	 2258254 B/op	    5754 allocs/op
Benchmark_Uint64Map_Sequential_Txn_Insert-4   	   10000	    104210 ns/op	   9596018 items/sec	   89520 B/op	    2040 allocs/op
Benchmark_Uint64Map_Random_Insert-4           	    1640	    725834 ns/op	   1377725 items/sec	 2562042 B/op	    6056 allocs/op
Benchmark_Uint64Map_Random_Txn_Insert-4       	    6138	    201383 ns/op	   4965661 items/sec	  174846 B/op	    2841 allocs/op
Benchmark_Insert_RootOnlyWatch-4              	   10000	    104497 ns/op	   9569648 objects/sec	   74766 B/op	    2045 allocs/op
Benchmark_Insert-4                            	    7839	    158075 ns/op	   6326108 objects/sec	  191541 B/op	    3082 allocs/op
Benchmark_Modify-4                            	   14745	     81067 ns/op	  12335464 objects/sec	   59770 B/op	    1015 allocs/op
Benchmark_GetInsert-4                         	   10000	    114556 ns/op	   8729322 objects/sec	   59720 B/op	    1015 allocs/op
Benchmark_Replace-4                           	41158612	        29.08 ns/op	  34386891 objects/sec	       0 B/op	       0 allocs/op
Benchmark_Replace_RootOnlyWatch-4             	41344840	        28.92 ns/op	  34580190 objects/sec	       0 B/op	       0 allocs/op
Benchmark_txn_1-4                             	 4739634	       248.0 ns/op	   4032850 objects/sec	     216 B/op	       4 allocs/op
Benchmark_txn_10-4                            	10129953	       114.3 ns/op	   8749873 objects/sec	      89 B/op	       2 allocs/op
Benchmark_txn_100-4                           	12833871	        91.63 ns/op	  10913490 objects/sec	      80 B/op	       2 allocs/op
Benchmark_txn_1000-4                          	11652145	       102.1 ns/op	   9793175 objects/sec	      67 B/op	       2 allocs/op
Benchmark_txn_delete_1-4                      	 1924498	       626.3 ns/op	   1596703 objects/sec	    2952 B/op	       5 allocs/op
Benchmark_txn_delete_10-4                     	 8763200	       138.2 ns/op	   7237249 objects/sec	     333 B/op	       1 allocs/op
Benchmark_txn_delete_100-4                    	14017152	        82.24 ns/op	  12160074 objects/sec	      70 B/op	       1 allocs/op
Benchmark_txn_delete_1000-4                   	16175190	        72.98 ns/op	  13702358 objects/sec	      27 B/op	       1 allocs/op
Benchmark_Get-4                               	   50272	     23897 ns/op	  41845574 objects/sec	       0 B/op	       0 allocs/op
Benchmark_Iterate-4                           	  197220	      6114 ns/op	 163564686 objects/sec	     104 B/op	       4 allocs/op
Benchmark_Hashmap_Insert-4                    	   19998	     59892 ns/op	  16696812 objects/sec	   74265 B/op	      20 allocs/op
Benchmark_Hashmap_Get_Uint64-4                	  174415	      6872 ns/op	 145511893 objects/sec	       0 B/op	       0 allocs/op
Benchmark_Hashmap_Get_Bytes-4                 	  143322	      8371 ns/op	 119466778 objects/sec	       0 B/op	       0 allocs/op
Benchmark_Delete_Random-4                     	      14	  83230488 ns/op	   1201483 objects/sec	87780388 B/op	  146423 allocs/op
Benchmark_nodeMutatedClear-4                  	100000000	        11.51 ns/op	       0 B/op	       0 allocs/op
Benchmark_nodeMutatedExists-4                 	243511300	         4.915 ns/op	       0 B/op	       0 allocs/op
Benchmark_find16-4                            	270007528	         4.437 ns/op	       0 B/op	       0 allocs/op
Benchmark_findIndex16-4                       	129771720	         9.246 ns/op	       0 B/op	       0 allocs/op
Benchmark_find4-4                             	455847873	         2.649 ns/op	       0 B/op	       0 allocs/op
Benchmark_findIndex4-4                        	378146060	         3.177 ns/op	       0 B/op	       0 allocs/op
PASS
ok  	github.com/cilium/statedb/part	39.635s
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]
PASS
ok  	github.com/cilium/statedb/tui	0.002s
go run ./reconciler/benchmark -quiet
1000000 objects reconciled in 2.28 seconds (batch size 1000)
Throughput 439316.96 objects per second
832MB total allocated, 6015181 in-use objects, 338MB bytes in use

Signed-off-by: Jussi Maki <jussi.maki@isovalent.com>
@joamaki joamaki force-pushed the pr/joamaki/statedb-tui branch from f397577 to 92dedfc Compare December 19, 2025 17:11
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