Skip to content

Commit

Permalink
Add comment for counter due to lint
Browse files Browse the repository at this point in the history
  • Loading branch information
highcloud100 committed Jan 9, 2024
1 parent a8c58f9 commit 2dd5891
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions pkg/document/json/counter.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,15 @@ func NewCounter(ctx *change.Context, counter *crdt.Counter) *Counter {
}
}

// TempCounter is a transmission object for creating a counter inside.
type TempCounter struct {
valueType crdt.CounterType
value interface{}
}

func NewTempCounter(t crdt.CounterType, n interface{}) TempCounter {
return TempCounter{
// NewTempCounter creates a new instance of TempCounter.
func NewTempCounter(t crdt.CounterType, n interface{}) *TempCounter {
return &TempCounter{
valueType: t,
value: n,
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/document/json/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func buildCRDTElement(

case *Text:
return NewText(context, crdt.NewText(crdt.NewRGATreeSplit(crdt.InitialTextNode()), ticket))
case TempCounter:
case *TempCounter:
switch elem.valueType {
case crdt.IntegerCnt:
counter, err := crdt.NewCounter(crdt.IntegerCnt, elem.value, ticket)
Expand Down

1 comment on commit 2dd5891

@github-actions
Copy link

Choose a reason for hiding this comment

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

Go Benchmark

Benchmark suite Current: 2dd5891 Previous: a8c58f9 Ratio
BenchmarkDocument/constructor_test - ns/op 1448 ns/op 1457 ns/op 0.99
BenchmarkDocument/constructor_test - B/op 1224 B/op 1224 B/op 1
BenchmarkDocument/constructor_test - allocs/op 21 allocs/op 21 allocs/op 1
BenchmarkDocument/status_test - ns/op 946.4 ns/op 849.5 ns/op 1.11
BenchmarkDocument/status_test - B/op 1192 B/op 1192 B/op 1
BenchmarkDocument/status_test - allocs/op 19 allocs/op 19 allocs/op 1
BenchmarkDocument/equals_test - ns/op 7343 ns/op 7524 ns/op 0.98
BenchmarkDocument/equals_test - B/op 6977 B/op 6977 B/op 1
BenchmarkDocument/equals_test - allocs/op 124 allocs/op 124 allocs/op 1
BenchmarkDocument/nested_update_test - ns/op 16687 ns/op 18601 ns/op 0.90
BenchmarkDocument/nested_update_test - B/op 12058 B/op 12059 B/op 1.00
BenchmarkDocument/nested_update_test - allocs/op 260 allocs/op 260 allocs/op 1
BenchmarkDocument/delete_test - ns/op 22391 ns/op 22335 ns/op 1.00
BenchmarkDocument/delete_test - B/op 15284 B/op 15284 B/op 1
BenchmarkDocument/delete_test - allocs/op 339 allocs/op 339 allocs/op 1
BenchmarkDocument/object_test - ns/op 8493 ns/op 8516 ns/op 1.00
BenchmarkDocument/object_test - B/op 6753 B/op 6753 B/op 1
BenchmarkDocument/object_test - allocs/op 118 allocs/op 118 allocs/op 1
BenchmarkDocument/array_test - ns/op 28851 ns/op 28781 ns/op 1.00
BenchmarkDocument/array_test - B/op 11883 B/op 11883 B/op 1
BenchmarkDocument/array_test - allocs/op 274 allocs/op 274 allocs/op 1
BenchmarkDocument/text_test - ns/op 30530 ns/op 30487 ns/op 1.00
BenchmarkDocument/text_test - B/op 14827 B/op 14828 B/op 1.00
BenchmarkDocument/text_test - allocs/op 470 allocs/op 470 allocs/op 1
BenchmarkDocument/text_composition_test - ns/op 28824 ns/op 28865 ns/op 1.00
BenchmarkDocument/text_composition_test - B/op 18310 B/op 18310 B/op 1
BenchmarkDocument/text_composition_test - allocs/op 479 allocs/op 479 allocs/op 1
BenchmarkDocument/rich_text_test - ns/op 80083 ns/op 80677 ns/op 0.99
BenchmarkDocument/rich_text_test - B/op 38572 B/op 38572 B/op 1
BenchmarkDocument/rich_text_test - allocs/op 1149 allocs/op 1149 allocs/op 1
BenchmarkDocument/counter_test - ns/op 16757 ns/op 16759 ns/op 1.00
BenchmarkDocument/counter_test - B/op 10242 B/op 10242 B/op 1
BenchmarkDocument/counter_test - allocs/op 238 allocs/op 238 allocs/op 1
BenchmarkDocument/text_edit_gc_100 - ns/op 2882562 ns/op 2887897 ns/op 1.00
BenchmarkDocument/text_edit_gc_100 - B/op 1655258 B/op 1655169 B/op 1.00
BenchmarkDocument/text_edit_gc_100 - allocs/op 17094 allocs/op 17094 allocs/op 1
BenchmarkDocument/text_edit_gc_1000 - ns/op 228993311 ns/op 229415441 ns/op 1.00
BenchmarkDocument/text_edit_gc_1000 - B/op 144329224 B/op 144344868 B/op 1.00
BenchmarkDocument/text_edit_gc_1000 - allocs/op 200841 allocs/op 200908 allocs/op 1.00
BenchmarkDocument/text_split_gc_100 - ns/op 3365274 ns/op 3374708 ns/op 1.00
BenchmarkDocument/text_split_gc_100 - B/op 2313638 B/op 2313351 B/op 1.00
BenchmarkDocument/text_split_gc_100 - allocs/op 16197 allocs/op 16195 allocs/op 1.00
BenchmarkDocument/text_split_gc_1000 - ns/op 286460854 ns/op 287430465 ns/op 1.00
BenchmarkDocument/text_split_gc_1000 - B/op 228882228 B/op 228891160 B/op 1.00
BenchmarkDocument/text_split_gc_1000 - allocs/op 203903 allocs/op 203934 allocs/op 1.00
BenchmarkDocument/text_delete_all_10000 - ns/op 10681853 ns/op 10779697 ns/op 0.99
BenchmarkDocument/text_delete_all_10000 - B/op 5810091 B/op 5809238 B/op 1.00
BenchmarkDocument/text_delete_all_10000 - allocs/op 40673 allocs/op 40669 allocs/op 1.00
BenchmarkDocument/text_delete_all_100000 - ns/op 181852622 ns/op 188925896 ns/op 0.96
BenchmarkDocument/text_delete_all_100000 - B/op 81900000 B/op 81910706 B/op 1.00
BenchmarkDocument/text_delete_all_100000 - allocs/op 411623 allocs/op 411662 allocs/op 1.00
BenchmarkDocument/text_100 - ns/op 219815 ns/op 229354 ns/op 0.96
BenchmarkDocument/text_100 - B/op 118515 B/op 118514 B/op 1.00
BenchmarkDocument/text_100 - allocs/op 5082 allocs/op 5082 allocs/op 1
BenchmarkDocument/text_1000 - ns/op 2399647 ns/op 2502759 ns/op 0.96
BenchmarkDocument/text_1000 - B/op 1153102 B/op 1153102 B/op 1
BenchmarkDocument/text_1000 - allocs/op 50086 allocs/op 50086 allocs/op 1
BenchmarkDocument/array_1000 - ns/op 1197249 ns/op 1262770 ns/op 0.95
BenchmarkDocument/array_1000 - B/op 1091283 B/op 1091147 B/op 1.00
BenchmarkDocument/array_1000 - allocs/op 11829 allocs/op 11829 allocs/op 1
BenchmarkDocument/array_10000 - ns/op 13134986 ns/op 13221008 ns/op 0.99
BenchmarkDocument/array_10000 - B/op 9801306 B/op 9799195 B/op 1.00
BenchmarkDocument/array_10000 - allocs/op 120300 allocs/op 120291 allocs/op 1.00
BenchmarkDocument/array_gc_100 - ns/op 162859 ns/op 172372 ns/op 0.94
BenchmarkDocument/array_gc_100 - B/op 139911 B/op 139899 B/op 1.00
BenchmarkDocument/array_gc_100 - allocs/op 1473 allocs/op 1472 allocs/op 1.00
BenchmarkDocument/array_gc_1000 - ns/op 1562419 ns/op 1651513 ns/op 0.95
BenchmarkDocument/array_gc_1000 - B/op 1241573 B/op 1241466 B/op 1.00
BenchmarkDocument/array_gc_1000 - allocs/op 14897 allocs/op 14897 allocs/op 1
BenchmarkDocument/counter_1000 - ns/op 197200 ns/op 210894 ns/op 0.94
BenchmarkDocument/counter_1000 - B/op 192883 B/op 192884 B/op 1.00
BenchmarkDocument/counter_1000 - allocs/op 5767 allocs/op 5767 allocs/op 1
BenchmarkDocument/counter_10000 - ns/op 2146383 ns/op 2217464 ns/op 0.97
BenchmarkDocument/counter_10000 - B/op 2087815 B/op 2087814 B/op 1.00
BenchmarkDocument/counter_10000 - allocs/op 59774 allocs/op 59774 allocs/op 1
BenchmarkDocument/object_1000 - ns/op 1349700 ns/op 1442631 ns/op 0.94
BenchmarkDocument/object_1000 - B/op 1428012 B/op 1428083 B/op 1.00
BenchmarkDocument/object_1000 - allocs/op 9847 allocs/op 9847 allocs/op 1
BenchmarkDocument/object_10000 - ns/op 14921794 ns/op 15149865 ns/op 0.98
BenchmarkDocument/object_10000 - B/op 12166042 B/op 12166338 B/op 1.00
BenchmarkDocument/object_10000 - allocs/op 100560 allocs/op 100562 allocs/op 1.00
BenchmarkDocument/tree_100 - ns/op 1026411 ns/op 1068412 ns/op 0.96
BenchmarkDocument/tree_100 - B/op 943715 B/op 943709 B/op 1.00
BenchmarkDocument/tree_100 - allocs/op 6101 allocs/op 6101 allocs/op 1
BenchmarkDocument/tree_1000 - ns/op 74817530 ns/op 79029252 ns/op 0.95
BenchmarkDocument/tree_1000 - B/op 86460368 B/op 86460602 B/op 1.00
BenchmarkDocument/tree_1000 - allocs/op 60115 allocs/op 60116 allocs/op 1.00
BenchmarkDocument/tree_10000 - ns/op 9345584723 ns/op 9661149264 ns/op 0.97
BenchmarkDocument/tree_10000 - B/op 8580664936 B/op 8580973784 B/op 1.00
BenchmarkDocument/tree_10000 - allocs/op 600243 allocs/op 600230 allocs/op 1.00
BenchmarkDocument/tree_delete_all_1000 - ns/op 72217392 ns/op 79816852 ns/op 0.90
BenchmarkDocument/tree_delete_all_1000 - B/op 87012769 B/op 86990889 B/op 1.00
BenchmarkDocument/tree_delete_all_1000 - allocs/op 67754 allocs/op 67750 allocs/op 1.00
BenchmarkDocument/tree_edit_gc_100 - ns/op 3640430 ns/op 3866691 ns/op 0.94
BenchmarkDocument/tree_edit_gc_100 - B/op 4121046 B/op 4121023 B/op 1.00
BenchmarkDocument/tree_edit_gc_100 - allocs/op 14358 allocs/op 14358 allocs/op 1
BenchmarkDocument/tree_edit_gc_1000 - ns/op 295324706 ns/op 326051394 ns/op 0.91
BenchmarkDocument/tree_edit_gc_1000 - B/op 383464774 B/op 383466086 B/op 1.00
BenchmarkDocument/tree_edit_gc_1000 - allocs/op 145396 allocs/op 145407 allocs/op 1.00
BenchmarkDocument/tree_split_gc_100 - ns/op 2430675 ns/op 2611696 ns/op 0.93
BenchmarkDocument/tree_split_gc_100 - B/op 2386880 B/op 2386898 B/op 1.00
BenchmarkDocument/tree_split_gc_100 - allocs/op 10343 allocs/op 10343 allocs/op 1
BenchmarkDocument/tree_split_gc_1000 - ns/op 180047531 ns/op 196739556 ns/op 0.92
BenchmarkDocument/tree_split_gc_1000 - B/op 221990410 B/op 221991590 B/op 1.00
BenchmarkDocument/tree_split_gc_1000 - allocs/op 112249 allocs/op 112260 allocs/op 1.00
BenchmarkRPC/client_to_server - ns/op 355806093 ns/op 356144469 ns/op 1.00
BenchmarkRPC/client_to_server - B/op 17218424 B/op 17801216 B/op 0.97
BenchmarkRPC/client_to_server - allocs/op 166847 allocs/op 166911 allocs/op 1.00
BenchmarkRPC/client_to_client_via_server - ns/op 608083991 ns/op 613079232 ns/op 0.99
BenchmarkRPC/client_to_client_via_server - B/op 32857532 B/op 31722656 B/op 1.04
BenchmarkRPC/client_to_client_via_server - allocs/op 312472 allocs/op 313048 allocs/op 1.00
BenchmarkRPC/attach_large_document - ns/op 1403523364 ns/op 1479934941 ns/op 0.95
BenchmarkRPC/attach_large_document - B/op 1890027144 B/op 1890029520 B/op 1.00
BenchmarkRPC/attach_large_document - allocs/op 7554 allocs/op 7567 allocs/op 1.00
BenchmarkRPC/adminCli_to_server - ns/op 533693962 ns/op 537051132 ns/op 0.99
BenchmarkRPC/adminCli_to_server - B/op 35995328 B/op 36806452 B/op 0.98
BenchmarkRPC/adminCli_to_server - allocs/op 289672 allocs/op 289659 allocs/op 1.00
BenchmarkLocker - ns/op 63.95 ns/op 65.34 ns/op 0.98
BenchmarkLocker - B/op 16 B/op 16 B/op 1
BenchmarkLocker - allocs/op 1 allocs/op 1 allocs/op 1
BenchmarkLockerParallel - ns/op 38.72 ns/op 38.48 ns/op 1.01
BenchmarkLockerParallel - B/op 0 B/op 0 B/op NaN
BenchmarkLockerParallel - allocs/op 0 allocs/op 0 allocs/op NaN
BenchmarkLockerMoreKeys - ns/op 142.8 ns/op 145.1 ns/op 0.98
BenchmarkLockerMoreKeys - B/op 15 B/op 15 B/op 1
BenchmarkLockerMoreKeys - allocs/op 0 allocs/op 0 allocs/op NaN
BenchmarkChange/Push_10_Changes - ns/op 3771239 ns/op 3768343 ns/op 1.00
BenchmarkChange/Push_10_Changes - B/op 126340 B/op 126223 B/op 1.00
BenchmarkChange/Push_10_Changes - allocs/op 1254 allocs/op 1254 allocs/op 1
BenchmarkChange/Push_100_Changes - ns/op 14106956 ns/op 14005221 ns/op 1.01
BenchmarkChange/Push_100_Changes - B/op 642872 B/op 648654 B/op 0.99
BenchmarkChange/Push_100_Changes - allocs/op 6540 allocs/op 6539 allocs/op 1.00
BenchmarkChange/Push_1000_Changes - ns/op 112595371 ns/op 114047673 ns/op 0.99
BenchmarkChange/Push_1000_Changes - B/op 6075016 B/op 6036337 B/op 1.01
BenchmarkChange/Push_1000_Changes - allocs/op 62154 allocs/op 62157 allocs/op 1.00
BenchmarkChange/Pull_10_Changes - ns/op 2832289 ns/op 2839363 ns/op 1.00
BenchmarkChange/Pull_10_Changes - B/op 100629 B/op 100881 B/op 1.00
BenchmarkChange/Pull_10_Changes - allocs/op 952 allocs/op 952 allocs/op 1
BenchmarkChange/Pull_100_Changes - ns/op 4316259 ns/op 4308547 ns/op 1.00
BenchmarkChange/Pull_100_Changes - B/op 258058 B/op 258255 B/op 1.00
BenchmarkChange/Pull_100_Changes - allocs/op 3154 allocs/op 3154 allocs/op 1
BenchmarkChange/Pull_1000_Changes - ns/op 8352277 ns/op 8372656 ns/op 1.00
BenchmarkChange/Pull_1000_Changes - B/op 1399095 B/op 1396187 B/op 1.00
BenchmarkChange/Pull_1000_Changes - allocs/op 26877 allocs/op 26871 allocs/op 1.00
BenchmarkSnapshot/Push_3KB_snapshot - ns/op 16736115 ns/op 16777319 ns/op 1.00
BenchmarkSnapshot/Push_3KB_snapshot - B/op 808445 B/op 809995 B/op 1.00
BenchmarkSnapshot/Push_3KB_snapshot - allocs/op 6545 allocs/op 6542 allocs/op 1.00
BenchmarkSnapshot/Push_30KB_snapshot - ns/op 118105129 ns/op 117069671 ns/op 1.01
BenchmarkSnapshot/Push_30KB_snapshot - B/op 6171686 B/op 6250016 B/op 0.99
BenchmarkSnapshot/Push_30KB_snapshot - allocs/op 62165 allocs/op 62161 allocs/op 1.00
BenchmarkSnapshot/Pull_3KB_snapshot - ns/op 6583242 ns/op 6563310 ns/op 1.00
BenchmarkSnapshot/Pull_3KB_snapshot - B/op 905773 B/op 905174 B/op 1.00
BenchmarkSnapshot/Pull_3KB_snapshot - allocs/op 14884 allocs/op 14882 allocs/op 1.00
BenchmarkSnapshot/Pull_30KB_snapshot - ns/op 14843616 ns/op 15000336 ns/op 0.99
BenchmarkSnapshot/Pull_30KB_snapshot - B/op 6987281 B/op 6977754 B/op 1.00
BenchmarkSnapshot/Pull_30KB_snapshot - allocs/op 144148 allocs/op 144148 allocs/op 1
BenchmarkSync/memory_sync_10_test - ns/op 6792 ns/op 6824 ns/op 1.00
BenchmarkSync/memory_sync_10_test - B/op 1286 B/op 1286 B/op 1
BenchmarkSync/memory_sync_10_test - allocs/op 38 allocs/op 38 allocs/op 1
BenchmarkSync/memory_sync_100_test - ns/op 52507 ns/op 51635 ns/op 1.02
BenchmarkSync/memory_sync_100_test - B/op 8708 B/op 8659 B/op 1.01
BenchmarkSync/memory_sync_100_test - allocs/op 277 allocs/op 274 allocs/op 1.01
BenchmarkSync/memory_sync_1000_test - ns/op 566947 ns/op 582724 ns/op 0.97
BenchmarkSync/memory_sync_1000_test - B/op 75620 B/op 74925 B/op 1.01
BenchmarkSync/memory_sync_1000_test - allocs/op 2187 allocs/op 2141 allocs/op 1.02
BenchmarkSync/memory_sync_10000_test - ns/op 6999771 ns/op 7320373 ns/op 0.96
BenchmarkSync/memory_sync_10000_test - B/op 761016 B/op 761425 B/op 1.00
BenchmarkSync/memory_sync_10000_test - allocs/op 20673 allocs/op 20593 allocs/op 1.00
BenchmarkTextEditing - ns/op 18362618201 ns/op 18585017456 ns/op 0.99
BenchmarkTextEditing - B/op 9037788592 B/op 9037385240 B/op 1.00
BenchmarkTextEditing - allocs/op 19922401 allocs/op 19920435 allocs/op 1.00

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.