-
-
Notifications
You must be signed in to change notification settings - Fork 148
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
Extract DocEvent into events package #1137
Conversation
WalkthroughThis pull request refactors the handling of document event types throughout the codebase. It replaces the old event type definitions and conversions based on the Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant APIConverter
participant PubSubPublisher
participant Subscriber
Client->>APIConverter: Send protobuf document event
APIConverter->>APIConverter: Convert protobuf event using FromEventType/ToDocEventType
APIConverter->>PubSubPublisher: Forward events.DocEvent
PubSubPublisher->>Subscriber: Publish event via subscription channel
Possibly related PRs
Suggested labels
Suggested reviewers
Tip 🌐 Web search-backed reviews and chat
✨ Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
626303b
to
e07f631
Compare
There was a problem hiding this comment.
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: e07f631 | Previous: 626303b | Ratio |
---|---|---|---|
BenchmarkDocument/constructor_test |
1501 ns/op 1337 B/op 24 allocs/op |
1557 ns/op 1337 B/op 24 allocs/op |
0.96 |
BenchmarkDocument/constructor_test - ns/op |
1501 ns/op |
1557 ns/op |
0.96 |
BenchmarkDocument/constructor_test - B/op |
1337 B/op |
1337 B/op |
1 |
BenchmarkDocument/constructor_test - allocs/op |
24 allocs/op |
24 allocs/op |
1 |
BenchmarkDocument/status_test |
1003 ns/op 1305 B/op 22 allocs/op |
972.4 ns/op 1305 B/op 22 allocs/op |
1.03 |
BenchmarkDocument/status_test - ns/op |
1003 ns/op |
972.4 ns/op |
1.03 |
BenchmarkDocument/status_test - B/op |
1305 B/op |
1305 B/op |
1 |
BenchmarkDocument/status_test - allocs/op |
22 allocs/op |
22 allocs/op |
1 |
BenchmarkDocument/equals_test |
7818 ns/op 7529 B/op 134 allocs/op |
8023 ns/op 7529 B/op 134 allocs/op |
0.97 |
BenchmarkDocument/equals_test - ns/op |
7818 ns/op |
8023 ns/op |
0.97 |
BenchmarkDocument/equals_test - B/op |
7529 B/op |
7529 B/op |
1 |
BenchmarkDocument/equals_test - allocs/op |
134 allocs/op |
134 allocs/op |
1 |
BenchmarkDocument/nested_update_test |
17353 ns/op 12394 B/op 264 allocs/op |
20311 ns/op 12395 B/op 264 allocs/op |
0.85 |
BenchmarkDocument/nested_update_test - ns/op |
17353 ns/op |
20311 ns/op |
0.85 |
BenchmarkDocument/nested_update_test - B/op |
12394 B/op |
12395 B/op |
1.00 |
BenchmarkDocument/nested_update_test - allocs/op |
264 allocs/op |
264 allocs/op |
1 |
BenchmarkDocument/delete_test |
23417 ns/op 15923 B/op 347 allocs/op |
24013 ns/op 15923 B/op 347 allocs/op |
0.98 |
BenchmarkDocument/delete_test - ns/op |
23417 ns/op |
24013 ns/op |
0.98 |
BenchmarkDocument/delete_test - B/op |
15923 B/op |
15923 B/op |
1 |
BenchmarkDocument/delete_test - allocs/op |
347 allocs/op |
347 allocs/op |
1 |
BenchmarkDocument/object_test |
8941 ns/op 7073 B/op 122 allocs/op |
9169 ns/op 7073 B/op 122 allocs/op |
0.98 |
BenchmarkDocument/object_test - ns/op |
8941 ns/op |
9169 ns/op |
0.98 |
BenchmarkDocument/object_test - B/op |
7073 B/op |
7073 B/op |
1 |
BenchmarkDocument/object_test - allocs/op |
122 allocs/op |
122 allocs/op |
1 |
BenchmarkDocument/array_test |
30304 ns/op 12203 B/op 278 allocs/op |
30844 ns/op 12203 B/op 278 allocs/op |
0.98 |
BenchmarkDocument/array_test - ns/op |
30304 ns/op |
30844 ns/op |
0.98 |
BenchmarkDocument/array_test - B/op |
12203 B/op |
12203 B/op |
1 |
BenchmarkDocument/array_test - allocs/op |
278 allocs/op |
278 allocs/op |
1 |
BenchmarkDocument/text_test |
32465 ns/op 15323 B/op 492 allocs/op |
33090 ns/op 15324 B/op 492 allocs/op |
0.98 |
BenchmarkDocument/text_test - ns/op |
32465 ns/op |
33090 ns/op |
0.98 |
BenchmarkDocument/text_test - B/op |
15323 B/op |
15324 B/op |
1.00 |
BenchmarkDocument/text_test - allocs/op |
492 allocs/op |
492 allocs/op |
1 |
BenchmarkDocument/text_composition_test |
34754 ns/op 18716 B/op 504 allocs/op |
31447 ns/op 18719 B/op 504 allocs/op |
1.11 |
BenchmarkDocument/text_composition_test - ns/op |
34754 ns/op |
31447 ns/op |
1.11 |
BenchmarkDocument/text_composition_test - B/op |
18716 B/op |
18719 B/op |
1.00 |
BenchmarkDocument/text_composition_test - allocs/op |
504 allocs/op |
504 allocs/op |
1 |
BenchmarkDocument/rich_text_test |
84925 ns/op 40186 B/op 1183 allocs/op |
87112 ns/op 40181 B/op 1183 allocs/op |
0.97 |
BenchmarkDocument/rich_text_test - ns/op |
84925 ns/op |
87112 ns/op |
0.97 |
BenchmarkDocument/rich_text_test - B/op |
40186 B/op |
40181 B/op |
1.00 |
BenchmarkDocument/rich_text_test - allocs/op |
1183 allocs/op |
1183 allocs/op |
1 |
BenchmarkDocument/counter_test |
19070 ns/op 11874 B/op 258 allocs/op |
19048 ns/op 11874 B/op 258 allocs/op |
1.00 |
BenchmarkDocument/counter_test - ns/op |
19070 ns/op |
19048 ns/op |
1.00 |
BenchmarkDocument/counter_test - B/op |
11874 B/op |
11874 B/op |
1 |
BenchmarkDocument/counter_test - allocs/op |
258 allocs/op |
258 allocs/op |
1 |
BenchmarkDocument/text_edit_gc_100 |
1359535 ns/op 872583 B/op 17281 allocs/op |
1397416 ns/op 872588 B/op 17281 allocs/op |
0.97 |
BenchmarkDocument/text_edit_gc_100 - ns/op |
1359535 ns/op |
1397416 ns/op |
0.97 |
BenchmarkDocument/text_edit_gc_100 - B/op |
872583 B/op |
872588 B/op |
1.00 |
BenchmarkDocument/text_edit_gc_100 - allocs/op |
17281 allocs/op |
17281 allocs/op |
1 |
BenchmarkDocument/text_edit_gc_1000 |
51899448 ns/op 50546167 B/op 186742 allocs/op |
55267231 ns/op 50545691 B/op 186736 allocs/op |
0.94 |
BenchmarkDocument/text_edit_gc_1000 - ns/op |
51899448 ns/op |
55267231 ns/op |
0.94 |
BenchmarkDocument/text_edit_gc_1000 - B/op |
50546167 B/op |
50545691 B/op |
1.00 |
BenchmarkDocument/text_edit_gc_1000 - allocs/op |
186742 allocs/op |
186736 allocs/op |
1.00 |
BenchmarkDocument/text_split_gc_100 |
1980273 ns/op 1589075 B/op 15950 allocs/op |
2034847 ns/op 1589069 B/op 15950 allocs/op |
0.97 |
BenchmarkDocument/text_split_gc_100 - ns/op |
1980273 ns/op |
2034847 ns/op |
0.97 |
BenchmarkDocument/text_split_gc_100 - B/op |
1589075 B/op |
1589069 B/op |
1.00 |
BenchmarkDocument/text_split_gc_100 - allocs/op |
15950 allocs/op |
15950 allocs/op |
1 |
BenchmarkDocument/text_split_gc_1000 |
119876911 ns/op 141483200 B/op 186137 allocs/op |
122290340 ns/op 141482272 B/op 186153 allocs/op |
0.98 |
BenchmarkDocument/text_split_gc_1000 - ns/op |
119876911 ns/op |
122290340 ns/op |
0.98 |
BenchmarkDocument/text_split_gc_1000 - B/op |
141483200 B/op |
141482272 B/op |
1.00 |
BenchmarkDocument/text_split_gc_1000 - allocs/op |
186137 allocs/op |
186153 allocs/op |
1.00 |
BenchmarkDocument/text_delete_all_10000 |
16705860 ns/op 10214792 B/op 55687 allocs/op |
18812201 ns/op 10214029 B/op 55686 allocs/op |
0.89 |
BenchmarkDocument/text_delete_all_10000 - ns/op |
16705860 ns/op |
18812201 ns/op |
0.89 |
BenchmarkDocument/text_delete_all_10000 - B/op |
10214792 B/op |
10214029 B/op |
1.00 |
BenchmarkDocument/text_delete_all_10000 - allocs/op |
55687 allocs/op |
55686 allocs/op |
1.00 |
BenchmarkDocument/text_delete_all_100000 |
291945332 ns/op 143011040 B/op 561666 allocs/op |
342633053 ns/op 142972116 B/op 561717 allocs/op |
0.85 |
BenchmarkDocument/text_delete_all_100000 - ns/op |
291945332 ns/op |
342633053 ns/op |
0.85 |
BenchmarkDocument/text_delete_all_100000 - B/op |
143011040 B/op |
142972116 B/op |
1.00 |
BenchmarkDocument/text_delete_all_100000 - allocs/op |
561666 allocs/op |
561717 allocs/op |
1.00 |
BenchmarkDocument/text_100 |
227138 ns/op 120490 B/op 5182 allocs/op |
233388 ns/op 120491 B/op 5182 allocs/op |
0.97 |
BenchmarkDocument/text_100 - ns/op |
227138 ns/op |
233388 ns/op |
0.97 |
BenchmarkDocument/text_100 - B/op |
120490 B/op |
120491 B/op |
1.00 |
BenchmarkDocument/text_100 - allocs/op |
5182 allocs/op |
5182 allocs/op |
1 |
BenchmarkDocument/text_1000 |
2452864 ns/op 1171280 B/op 51086 allocs/op |
2568046 ns/op 1171280 B/op 51086 allocs/op |
0.96 |
BenchmarkDocument/text_1000 - ns/op |
2452864 ns/op |
2568046 ns/op |
0.96 |
BenchmarkDocument/text_1000 - B/op |
1171280 B/op |
1171280 B/op |
1 |
BenchmarkDocument/text_1000 - allocs/op |
51086 allocs/op |
51086 allocs/op |
1 |
BenchmarkDocument/array_1000 |
1279820 ns/op 1091824 B/op 11834 allocs/op |
1321790 ns/op 1091578 B/op 11833 allocs/op |
0.97 |
BenchmarkDocument/array_1000 - ns/op |
1279820 ns/op |
1321790 ns/op |
0.97 |
BenchmarkDocument/array_1000 - B/op |
1091824 B/op |
1091578 B/op |
1.00 |
BenchmarkDocument/array_1000 - allocs/op |
11834 allocs/op |
11833 allocs/op |
1.00 |
BenchmarkDocument/array_10000 |
13437439 ns/op 9800072 B/op 120297 allocs/op |
13798100 ns/op 9798812 B/op 120293 allocs/op |
0.97 |
BenchmarkDocument/array_10000 - ns/op |
13437439 ns/op |
13798100 ns/op |
0.97 |
BenchmarkDocument/array_10000 - B/op |
9800072 B/op |
9798812 B/op |
1.00 |
BenchmarkDocument/array_10000 - allocs/op |
120297 allocs/op |
120293 allocs/op |
1.00 |
BenchmarkDocument/array_gc_100 |
156890 ns/op 133285 B/op 1267 allocs/op |
163132 ns/op 133282 B/op 1266 allocs/op |
0.96 |
BenchmarkDocument/array_gc_100 - ns/op |
156890 ns/op |
163132 ns/op |
0.96 |
BenchmarkDocument/array_gc_100 - B/op |
133285 B/op |
133282 B/op |
1.00 |
BenchmarkDocument/array_gc_100 - allocs/op |
1267 allocs/op |
1266 allocs/op |
1.00 |
BenchmarkDocument/array_gc_1000 |
1453212 ns/op 1159652 B/op 12882 allocs/op |
1524352 ns/op 1159731 B/op 12883 allocs/op |
0.95 |
BenchmarkDocument/array_gc_1000 - ns/op |
1453212 ns/op |
1524352 ns/op |
0.95 |
BenchmarkDocument/array_gc_1000 - B/op |
1159652 B/op |
1159731 B/op |
1.00 |
BenchmarkDocument/array_gc_1000 - allocs/op |
12882 allocs/op |
12883 allocs/op |
1.00 |
BenchmarkDocument/counter_1000 |
206361 ns/op 193337 B/op 5773 allocs/op |
217160 ns/op 193336 B/op 5773 allocs/op |
0.95 |
BenchmarkDocument/counter_1000 - ns/op |
206361 ns/op |
217160 ns/op |
0.95 |
BenchmarkDocument/counter_1000 - B/op |
193337 B/op |
193336 B/op |
1.00 |
BenchmarkDocument/counter_1000 - allocs/op |
5773 allocs/op |
5773 allocs/op |
1 |
BenchmarkDocument/counter_10000 |
2181636 ns/op 2088252 B/op 59780 allocs/op |
2263175 ns/op 2088254 B/op 59780 allocs/op |
0.96 |
BenchmarkDocument/counter_10000 - ns/op |
2181636 ns/op |
2263175 ns/op |
0.96 |
BenchmarkDocument/counter_10000 - B/op |
2088252 B/op |
2088254 B/op |
1.00 |
BenchmarkDocument/counter_10000 - allocs/op |
59780 allocs/op |
59780 allocs/op |
1 |
BenchmarkDocument/object_1000 |
1425937 ns/op 1428276 B/op 9851 allocs/op |
1523735 ns/op 1428323 B/op 9851 allocs/op |
0.94 |
BenchmarkDocument/object_1000 - ns/op |
1425937 ns/op |
1523735 ns/op |
0.94 |
BenchmarkDocument/object_1000 - B/op |
1428276 B/op |
1428323 B/op |
1.00 |
BenchmarkDocument/object_1000 - allocs/op |
9851 allocs/op |
9851 allocs/op |
1 |
BenchmarkDocument/object_10000 |
15622329 ns/op 12168120 B/op 100572 allocs/op |
15914474 ns/op 12167724 B/op 100568 allocs/op |
0.98 |
BenchmarkDocument/object_10000 - ns/op |
15622329 ns/op |
15914474 ns/op |
0.98 |
BenchmarkDocument/object_10000 - B/op |
12168120 B/op |
12167724 B/op |
1.00 |
BenchmarkDocument/object_10000 - allocs/op |
100572 allocs/op |
100568 allocs/op |
1.00 |
BenchmarkDocument/tree_100 |
1060054 ns/op 943965 B/op 6103 allocs/op |
1107917 ns/op 943959 B/op 6103 allocs/op |
0.96 |
BenchmarkDocument/tree_100 - ns/op |
1060054 ns/op |
1107917 ns/op |
0.96 |
BenchmarkDocument/tree_100 - B/op |
943965 B/op |
943959 B/op |
1.00 |
BenchmarkDocument/tree_100 - allocs/op |
6103 allocs/op |
6103 allocs/op |
1 |
BenchmarkDocument/tree_1000 |
76526223 ns/op 86460618 B/op 60117 allocs/op |
85036177 ns/op 86460870 B/op 60117 allocs/op |
0.90 |
BenchmarkDocument/tree_1000 - ns/op |
76526223 ns/op |
85036177 ns/op |
0.90 |
BenchmarkDocument/tree_1000 - B/op |
86460618 B/op |
86460870 B/op |
1.00 |
BenchmarkDocument/tree_1000 - allocs/op |
60117 allocs/op |
60117 allocs/op |
1 |
BenchmarkDocument/tree_10000 |
9421142908 ns/op 8580658592 B/op 600195 allocs/op |
10297734640 ns/op 8580662016 B/op 600236 allocs/op |
0.91 |
BenchmarkDocument/tree_10000 - ns/op |
9421142908 ns/op |
10297734640 ns/op |
0.91 |
BenchmarkDocument/tree_10000 - B/op |
8580658592 B/op |
8580662016 B/op |
1.00 |
BenchmarkDocument/tree_10000 - allocs/op |
600195 allocs/op |
600236 allocs/op |
1.00 |
BenchmarkDocument/tree_delete_all_1000 |
78682007 ns/op 87511375 B/op 75273 allocs/op |
85379966 ns/op 87509525 B/op 75269 allocs/op |
0.92 |
BenchmarkDocument/tree_delete_all_1000 - ns/op |
78682007 ns/op |
85379966 ns/op |
0.92 |
BenchmarkDocument/tree_delete_all_1000 - B/op |
87511375 B/op |
87509525 B/op |
1.00 |
BenchmarkDocument/tree_delete_all_1000 - allocs/op |
75273 allocs/op |
75269 allocs/op |
1.00 |
BenchmarkDocument/tree_edit_gc_100 |
3928728 ns/op 4147314 B/op 15147 allocs/op |
4172690 ns/op 4147320 B/op 15147 allocs/op |
0.94 |
BenchmarkDocument/tree_edit_gc_100 - ns/op |
3928728 ns/op |
4172690 ns/op |
0.94 |
BenchmarkDocument/tree_edit_gc_100 - B/op |
4147314 B/op |
4147320 B/op |
1.00 |
BenchmarkDocument/tree_edit_gc_100 - allocs/op |
15147 allocs/op |
15147 allocs/op |
1 |
BenchmarkDocument/tree_edit_gc_1000 |
308231906 ns/op 383746976 B/op 154868 allocs/op |
340012174 ns/op 383748986 B/op 154873 allocs/op |
0.91 |
BenchmarkDocument/tree_edit_gc_1000 - ns/op |
308231906 ns/op |
340012174 ns/op |
0.91 |
BenchmarkDocument/tree_edit_gc_1000 - B/op |
383746976 B/op |
383748986 B/op |
1.00 |
BenchmarkDocument/tree_edit_gc_1000 - allocs/op |
154868 allocs/op |
154873 allocs/op |
1.00 |
BenchmarkDocument/tree_split_gc_100 |
2629517 ns/op 2413838 B/op 11131 allocs/op |
2818847 ns/op 2413148 B/op 11132 allocs/op |
0.93 |
BenchmarkDocument/tree_split_gc_100 - ns/op |
2629517 ns/op |
2818847 ns/op |
0.93 |
BenchmarkDocument/tree_split_gc_100 - B/op |
2413838 B/op |
2413148 B/op |
1.00 |
BenchmarkDocument/tree_split_gc_100 - allocs/op |
11131 allocs/op |
11132 allocs/op |
1.00 |
BenchmarkDocument/tree_split_gc_1000 |
188749187 ns/op 222252404 B/op 122003 allocs/op |
206922910 ns/op 222252524 B/op 122015 allocs/op |
0.91 |
BenchmarkDocument/tree_split_gc_1000 - ns/op |
188749187 ns/op |
206922910 ns/op |
0.91 |
BenchmarkDocument/tree_split_gc_1000 - B/op |
222252404 B/op |
222252524 B/op |
1.00 |
BenchmarkDocument/tree_split_gc_1000 - allocs/op |
122003 allocs/op |
122015 allocs/op |
1.00 |
BenchmarkRPC/client_to_server |
417870968 ns/op 19268586 B/op 216214 allocs/op |
435383510 ns/op 20445205 B/op 216348 allocs/op |
0.96 |
BenchmarkRPC/client_to_server - ns/op |
417870968 ns/op |
435383510 ns/op |
0.96 |
BenchmarkRPC/client_to_server - B/op |
19268586 B/op |
20445205 B/op |
0.94 |
BenchmarkRPC/client_to_server - allocs/op |
216214 allocs/op |
216348 allocs/op |
1.00 |
BenchmarkRPC/client_to_client_via_server |
774775366 ns/op 40916828 B/op 454561 allocs/op |
809867274 ns/op 41575968 B/op 462207 allocs/op |
0.96 |
BenchmarkRPC/client_to_client_via_server - ns/op |
774775366 ns/op |
809867274 ns/op |
0.96 |
BenchmarkRPC/client_to_client_via_server - B/op |
40916828 B/op |
41575968 B/op |
0.98 |
BenchmarkRPC/client_to_client_via_server - allocs/op |
454561 allocs/op |
462207 allocs/op |
0.98 |
BenchmarkRPC/attach_large_document |
1199297236 ns/op 1896536584 B/op 12102 allocs/op |
1315121695 ns/op 1898152784 B/op 11996 allocs/op |
0.91 |
BenchmarkRPC/attach_large_document - ns/op |
1199297236 ns/op |
1315121695 ns/op |
0.91 |
BenchmarkRPC/attach_large_document - B/op |
1896536584 B/op |
1898152784 B/op |
1.00 |
BenchmarkRPC/attach_large_document - allocs/op |
12102 allocs/op |
11996 allocs/op |
1.01 |
BenchmarkRPC/adminCli_to_server |
539430886 ns/op 36001364 B/op 289701 allocs/op |
546491025 ns/op 36003748 B/op 289740 allocs/op |
0.99 |
BenchmarkRPC/adminCli_to_server - ns/op |
539430886 ns/op |
546491025 ns/op |
0.99 |
BenchmarkRPC/adminCli_to_server - B/op |
36001364 B/op |
36003748 B/op |
1.00 |
BenchmarkRPC/adminCli_to_server - allocs/op |
289701 allocs/op |
289740 allocs/op |
1.00 |
BenchmarkLocker |
66.81 ns/op 16 B/op 1 allocs/op |
68.19 ns/op 16 B/op 1 allocs/op |
0.98 |
BenchmarkLocker - ns/op |
66.81 ns/op |
68.19 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 |
42 ns/op 0 B/op 0 allocs/op |
40.83 ns/op 0 B/op 0 allocs/op |
1.03 |
BenchmarkLockerParallel - ns/op |
42 ns/op |
40.83 ns/op |
1.03 |
BenchmarkLockerParallel - B/op |
0 B/op |
0 B/op |
1 |
BenchmarkLockerParallel - allocs/op |
0 allocs/op |
0 allocs/op |
1 |
BenchmarkLockerMoreKeys |
152.3 ns/op 15 B/op 0 allocs/op |
156.4 ns/op 15 B/op 0 allocs/op |
0.97 |
BenchmarkLockerMoreKeys - ns/op |
152.3 ns/op |
156.4 ns/op |
0.97 |
BenchmarkLockerMoreKeys - B/op |
15 B/op |
15 B/op |
1 |
BenchmarkLockerMoreKeys - allocs/op |
0 allocs/op |
0 allocs/op |
1 |
BenchmarkChange/Push_10_Changes |
4526110 ns/op 149478 B/op 1568 allocs/op |
4639385 ns/op 148804 B/op 1574 allocs/op |
0.98 |
BenchmarkChange/Push_10_Changes - ns/op |
4526110 ns/op |
4639385 ns/op |
0.98 |
BenchmarkChange/Push_10_Changes - B/op |
149478 B/op |
148804 B/op |
1.00 |
BenchmarkChange/Push_10_Changes - allocs/op |
1568 allocs/op |
1574 allocs/op |
1.00 |
BenchmarkChange/Push_100_Changes |
16265054 ns/op 790310 B/op 8277 allocs/op |
16970579 ns/op 787084 B/op 8284 allocs/op |
0.96 |
BenchmarkChange/Push_100_Changes - ns/op |
16265054 ns/op |
16970579 ns/op |
0.96 |
BenchmarkChange/Push_100_Changes - B/op |
790310 B/op |
787084 B/op |
1.00 |
BenchmarkChange/Push_100_Changes - allocs/op |
8277 allocs/op |
8284 allocs/op |
1.00 |
BenchmarkChange/Push_1000_Changes |
127706207 ns/op 7157363 B/op 77293 allocs/op |
132056128 ns/op 7134218 B/op 77294 allocs/op |
0.97 |
BenchmarkChange/Push_1000_Changes - ns/op |
127706207 ns/op |
132056128 ns/op |
0.97 |
BenchmarkChange/Push_1000_Changes - B/op |
7157363 B/op |
7134218 B/op |
1.00 |
BenchmarkChange/Push_1000_Changes - allocs/op |
77293 allocs/op |
77294 allocs/op |
1.00 |
BenchmarkChange/Pull_10_Changes |
3685358 ns/op 123538 B/op 1406 allocs/op |
3829533 ns/op 122690 B/op 1406 allocs/op |
0.96 |
BenchmarkChange/Pull_10_Changes - ns/op |
3685358 ns/op |
3829533 ns/op |
0.96 |
BenchmarkChange/Pull_10_Changes - B/op |
123538 B/op |
122690 B/op |
1.01 |
BenchmarkChange/Pull_10_Changes - allocs/op |
1406 allocs/op |
1406 allocs/op |
1 |
BenchmarkChange/Pull_100_Changes |
5292365 ns/op 351381 B/op 5041 allocs/op |
5473378 ns/op 349386 B/op 5039 allocs/op |
0.97 |
BenchmarkChange/Pull_100_Changes - ns/op |
5292365 ns/op |
5473378 ns/op |
0.97 |
BenchmarkChange/Pull_100_Changes - B/op |
351381 B/op |
349386 B/op |
1.01 |
BenchmarkChange/Pull_100_Changes - allocs/op |
5041 allocs/op |
5039 allocs/op |
1.00 |
BenchmarkChange/Pull_1000_Changes |
10824372 ns/op 2225601 B/op 43658 allocs/op |
11351193 ns/op 2225962 B/op 43654 allocs/op |
0.95 |
BenchmarkChange/Pull_1000_Changes - ns/op |
10824372 ns/op |
11351193 ns/op |
0.95 |
BenchmarkChange/Pull_1000_Changes - B/op |
2225601 B/op |
2225962 B/op |
1.00 |
BenchmarkChange/Pull_1000_Changes - allocs/op |
43658 allocs/op |
43654 allocs/op |
1.00 |
BenchmarkSnapshot/Push_3KB_snapshot |
18551214 ns/op 908987 B/op 8286 allocs/op |
19199275 ns/op 908407 B/op 8286 allocs/op |
0.97 |
BenchmarkSnapshot/Push_3KB_snapshot - ns/op |
18551214 ns/op |
19199275 ns/op |
0.97 |
BenchmarkSnapshot/Push_3KB_snapshot - B/op |
908987 B/op |
908407 B/op |
1.00 |
BenchmarkSnapshot/Push_3KB_snapshot - allocs/op |
8286 allocs/op |
8286 allocs/op |
1 |
BenchmarkSnapshot/Push_30KB_snapshot |
131935621 ns/op 8229917 B/op 86369 allocs/op |
136143846 ns/op 8511859 B/op 91131 allocs/op |
0.97 |
BenchmarkSnapshot/Push_30KB_snapshot - ns/op |
131935621 ns/op |
136143846 ns/op |
0.97 |
BenchmarkSnapshot/Push_30KB_snapshot - B/op |
8229917 B/op |
8511859 B/op |
0.97 |
BenchmarkSnapshot/Push_30KB_snapshot - allocs/op |
86369 allocs/op |
91131 allocs/op |
0.95 |
BenchmarkSnapshot/Pull_3KB_snapshot |
7717076 ns/op 1140417 B/op 19606 allocs/op |
8084709 ns/op 1138823 B/op 19608 allocs/op |
0.95 |
BenchmarkSnapshot/Pull_3KB_snapshot - ns/op |
7717076 ns/op |
8084709 ns/op |
0.95 |
BenchmarkSnapshot/Pull_3KB_snapshot - B/op |
1140417 B/op |
1138823 B/op |
1.00 |
BenchmarkSnapshot/Pull_3KB_snapshot - allocs/op |
19606 allocs/op |
19608 allocs/op |
1.00 |
BenchmarkSnapshot/Pull_30KB_snapshot |
19832570 ns/op 9330764 B/op 189486 allocs/op |
20300651 ns/op 9339024 B/op 189552 allocs/op |
0.98 |
BenchmarkSnapshot/Pull_30KB_snapshot - ns/op |
19832570 ns/op |
20300651 ns/op |
0.98 |
BenchmarkSnapshot/Pull_30KB_snapshot - B/op |
9330764 B/op |
9339024 B/op |
1.00 |
BenchmarkSnapshot/Pull_30KB_snapshot - allocs/op |
189486 allocs/op |
189552 allocs/op |
1.00 |
BenchmarkSplayTree/stress_test_100000 |
0.1943 ns/op 0 B/op 0 allocs/op |
0.2024 ns/op 0 B/op 0 allocs/op |
0.96 |
BenchmarkSplayTree/stress_test_100000 - ns/op |
0.1943 ns/op |
0.2024 ns/op |
0.96 |
BenchmarkSplayTree/stress_test_100000 - B/op |
0 B/op |
0 B/op |
1 |
BenchmarkSplayTree/stress_test_100000 - allocs/op |
0 allocs/op |
0 allocs/op |
1 |
BenchmarkSplayTree/stress_test_200000 |
0.3922 ns/op 0 B/op 0 allocs/op |
0.4018 ns/op 0 B/op 0 allocs/op |
0.98 |
BenchmarkSplayTree/stress_test_200000 - ns/op |
0.3922 ns/op |
0.4018 ns/op |
0.98 |
BenchmarkSplayTree/stress_test_200000 - B/op |
0 B/op |
0 B/op |
1 |
BenchmarkSplayTree/stress_test_200000 - allocs/op |
0 allocs/op |
0 allocs/op |
1 |
BenchmarkSplayTree/stress_test_300000 |
0.5818 ns/op 0 B/op 0 allocs/op |
0.5803 ns/op 0 B/op 0 allocs/op |
1.00 |
BenchmarkSplayTree/stress_test_300000 - ns/op |
0.5818 ns/op |
0.5803 ns/op |
1.00 |
BenchmarkSplayTree/stress_test_300000 - B/op |
0 B/op |
0 B/op |
1 |
BenchmarkSplayTree/stress_test_300000 - allocs/op |
0 allocs/op |
0 allocs/op |
1 |
BenchmarkSplayTree/random_access_100000 |
0.01247 ns/op 0 B/op 0 allocs/op |
0.01337 ns/op 0 B/op 0 allocs/op |
0.93 |
BenchmarkSplayTree/random_access_100000 - ns/op |
0.01247 ns/op |
0.01337 ns/op |
0.93 |
BenchmarkSplayTree/random_access_100000 - B/op |
0 B/op |
0 B/op |
1 |
BenchmarkSplayTree/random_access_100000 - allocs/op |
0 allocs/op |
0 allocs/op |
1 |
BenchmarkSplayTree/random_access_200000 |
0.02897 ns/op 0 B/op 0 allocs/op |
0.0306 ns/op 0 B/op 0 allocs/op |
0.95 |
BenchmarkSplayTree/random_access_200000 - ns/op |
0.02897 ns/op |
0.0306 ns/op |
0.95 |
BenchmarkSplayTree/random_access_200000 - B/op |
0 B/op |
0 B/op |
1 |
BenchmarkSplayTree/random_access_200000 - allocs/op |
0 allocs/op |
0 allocs/op |
1 |
BenchmarkSplayTree/random_access_300000 |
0.04115 ns/op 0 B/op 0 allocs/op |
0.04421 ns/op 0 B/op 0 allocs/op |
0.93 |
BenchmarkSplayTree/random_access_300000 - ns/op |
0.04115 ns/op |
0.04421 ns/op |
0.93 |
BenchmarkSplayTree/random_access_300000 - B/op |
0 B/op |
0 B/op |
1 |
BenchmarkSplayTree/random_access_300000 - allocs/op |
0 allocs/op |
0 allocs/op |
1 |
BenchmarkSplayTree/editing_trace_bench |
0.001817 ns/op 0 B/op 0 allocs/op |
0.002304 ns/op 0 B/op 0 allocs/op |
0.79 |
BenchmarkSplayTree/editing_trace_bench - ns/op |
0.001817 ns/op |
0.002304 ns/op |
0.79 |
BenchmarkSplayTree/editing_trace_bench - B/op |
0 B/op |
0 B/op |
1 |
BenchmarkSplayTree/editing_trace_bench - allocs/op |
0 allocs/op |
0 allocs/op |
1 |
BenchmarkSync/memory_sync_10_test |
7431 ns/op 1182 B/op 35 allocs/op |
7476 ns/op 1183 B/op 35 allocs/op |
0.99 |
BenchmarkSync/memory_sync_10_test - ns/op |
7431 ns/op |
7476 ns/op |
0.99 |
BenchmarkSync/memory_sync_10_test - B/op |
1182 B/op |
1183 B/op |
1.00 |
BenchmarkSync/memory_sync_10_test - allocs/op |
35 allocs/op |
35 allocs/op |
1 |
BenchmarkSync/memory_sync_100_test |
53877 ns/op 8540 B/op 270 allocs/op |
54253 ns/op 8522 B/op 269 allocs/op |
0.99 |
BenchmarkSync/memory_sync_100_test - ns/op |
53877 ns/op |
54253 ns/op |
0.99 |
BenchmarkSync/memory_sync_100_test - B/op |
8540 B/op |
8522 B/op |
1.00 |
BenchmarkSync/memory_sync_100_test - allocs/op |
270 allocs/op |
269 allocs/op |
1.00 |
BenchmarkSync/memory_sync_1000_test |
588378 ns/op 74606 B/op 2127 allocs/op |
596098 ns/op 74610 B/op 2129 allocs/op |
0.99 |
BenchmarkSync/memory_sync_1000_test - ns/op |
588378 ns/op |
596098 ns/op |
0.99 |
BenchmarkSync/memory_sync_1000_test - B/op |
74606 B/op |
74610 B/op |
1.00 |
BenchmarkSync/memory_sync_1000_test - allocs/op |
2127 allocs/op |
2129 allocs/op |
1.00 |
BenchmarkSync/memory_sync_10000_test |
7445854 ns/op 754870 B/op 20404 allocs/op |
7974713 ns/op 766821 B/op 20680 allocs/op |
0.93 |
BenchmarkSync/memory_sync_10000_test - ns/op |
7445854 ns/op |
7974713 ns/op |
0.93 |
BenchmarkSync/memory_sync_10000_test - B/op |
754870 B/op |
766821 B/op |
0.98 |
BenchmarkSync/memory_sync_10000_test - allocs/op |
20404 allocs/op |
20680 allocs/op |
0.99 |
BenchmarkTextEditing |
5205040665 ns/op 3982590912 B/op 20647688 allocs/op |
5356387453 ns/op 3982603976 B/op 20647662 allocs/op |
0.97 |
BenchmarkTextEditing - ns/op |
5205040665 ns/op |
5356387453 ns/op |
0.97 |
BenchmarkTextEditing - B/op |
3982590912 B/op |
3982603976 B/op |
1.00 |
BenchmarkTextEditing - allocs/op |
20647688 allocs/op |
20647662 allocs/op |
1.00 |
BenchmarkTree/10000_vertices_to_protobuf |
4167703 ns/op 6263012 B/op 70025 allocs/op |
4496902 ns/op 6263018 B/op 70025 allocs/op |
0.93 |
BenchmarkTree/10000_vertices_to_protobuf - ns/op |
4167703 ns/op |
4496902 ns/op |
0.93 |
BenchmarkTree/10000_vertices_to_protobuf - B/op |
6263012 B/op |
6263018 B/op |
1.00 |
BenchmarkTree/10000_vertices_to_protobuf - allocs/op |
70025 allocs/op |
70025 allocs/op |
1 |
BenchmarkTree/10000_vertices_from_protobuf |
223359372 ns/op 442171937 B/op 290039 allocs/op |
232240102 ns/op 442170372 B/op 290039 allocs/op |
0.96 |
BenchmarkTree/10000_vertices_from_protobuf - ns/op |
223359372 ns/op |
232240102 ns/op |
0.96 |
BenchmarkTree/10000_vertices_from_protobuf - B/op |
442171937 B/op |
442170372 B/op |
1.00 |
BenchmarkTree/10000_vertices_from_protobuf - allocs/op |
290039 allocs/op |
290039 allocs/op |
1 |
BenchmarkTree/20000_vertices_to_protobuf |
8862686 ns/op 12717007 B/op 140028 allocs/op |
9599777 ns/op 12722082 B/op 140028 allocs/op |
0.92 |
BenchmarkTree/20000_vertices_to_protobuf - ns/op |
8862686 ns/op |
9599777 ns/op |
0.92 |
BenchmarkTree/20000_vertices_to_protobuf - B/op |
12717007 B/op |
12722082 B/op |
1.00 |
BenchmarkTree/20000_vertices_to_protobuf - allocs/op |
140028 allocs/op |
140028 allocs/op |
1 |
BenchmarkTree/20000_vertices_from_protobuf |
885288007 ns/op 1697276540 B/op 580089 allocs/op |
894939797 ns/op 1697267784 B/op 580042 allocs/op |
0.99 |
BenchmarkTree/20000_vertices_from_protobuf - ns/op |
885288007 ns/op |
894939797 ns/op |
0.99 |
BenchmarkTree/20000_vertices_from_protobuf - B/op |
1697276540 B/op |
1697267784 B/op |
1.00 |
BenchmarkTree/20000_vertices_from_protobuf - allocs/op |
580089 allocs/op |
580042 allocs/op |
1.00 |
BenchmarkTree/30000_vertices_to_protobuf |
14307034 ns/op 19318365 B/op 210030 allocs/op |
15279719 ns/op 19318465 B/op 210031 allocs/op |
0.94 |
BenchmarkTree/30000_vertices_to_protobuf - ns/op |
14307034 ns/op |
15279719 ns/op |
0.94 |
BenchmarkTree/30000_vertices_to_protobuf - B/op |
19318365 B/op |
19318465 B/op |
1.00 |
BenchmarkTree/30000_vertices_to_protobuf - allocs/op |
210030 allocs/op |
210031 allocs/op |
1.00 |
BenchmarkTree/30000_vertices_from_protobuf |
2011429910 ns/op 3752044920 B/op 870054 allocs/op |
1991519568 ns/op 3752051928 B/op 870046 allocs/op |
1.01 |
BenchmarkTree/30000_vertices_from_protobuf - ns/op |
2011429910 ns/op |
1991519568 ns/op |
1.01 |
BenchmarkTree/30000_vertices_from_protobuf - B/op |
3752044920 B/op |
3752051928 B/op |
1.00 |
BenchmarkTree/30000_vertices_from_protobuf - allocs/op |
870054 allocs/op |
870046 allocs/op |
1.00 |
This comment was automatically generated by workflow using github-action-benchmark.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1137 +/- ##
=======================================
Coverage 47.11% 47.11%
=======================================
Files 84 83 -1
Lines 12333 12333
=======================================
Hits 5811 5811
Misses 5935 5935
Partials 587 587 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (3)
api/types/events/events.go (1)
53-55
: Consider caching payload length for better performance.For large payloads, computing length on every call might be inefficient. Consider caching the length when payload is set.
type DocEventBody struct { Topic string Payload []byte + payloadLen int // cached length } -func (b *DocEventBody) PayloadLen() int { - return len(b.Payload) +func (b *DocEventBody) PayloadLen() int { + return b.payloadLen +} + +func (b *DocEventBody) SetPayload(payload []byte) { + b.Payload = payload + b.payloadLen = len(payload) +}server/backend/pubsub/subscription.go (1)
43-43
: Consider making channel buffer size configurable.The event channel buffer size is hardcoded to 1. Consider making it configurable for different use cases and performance requirements.
+// DefaultEventBufferSize is the default size of the event channel buffer +const DefaultEventBufferSize = 1 + +// Config holds configuration for Subscription +type Config struct { + EventBufferSize int +} + -func NewSubscription(subscriber *time.ActorID) *Subscription { +func NewSubscription(subscriber *time.ActorID, config *Config) *Subscription { + bufferSize := DefaultEventBufferSize + if config != nil && config.EventBufferSize > 0 { + bufferSize = config.EventBufferSize + } return &Subscription{ id: xid.New().String(), subscriber: subscriber, - events: make(chan events.DocEvent, 1), + events: make(chan events.DocEvent, bufferSize), closed: false, } }server/backend/pubsub/publisher.go (1)
71-73
: Consider implementing the TODO optimization.The comment suggests an optimization for handling duplicate DocumentChangedEvents. This could improve performance by reducing unnecessary event processing.
Would you like me to help implement this optimization? I can provide a solution that efficiently handles duplicate DocumentChangedEvents in the batch.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (15)
api/converter/from_pb.go
(2 hunks)api/converter/to_pb.go
(2 hunks)api/types/event.go
(0 hunks)api/types/events/events.go
(1 hunks)client/client.go
(4 hunks)pkg/webhook/client.go
(1 hunks)server/backend/pubsub/publisher.go
(3 hunks)server/backend/pubsub/pubsub.go
(3 hunks)server/backend/pubsub/pubsub_test.go
(2 hunks)server/backend/pubsub/subscription.go
(4 hunks)server/packs/packs.go
(2 hunks)server/profiling/prometheus/metrics.go
(3 hunks)server/rpc/admin_server.go
(2 hunks)server/rpc/server.go
(0 hunks)server/rpc/yorkie_server.go
(6 hunks)
💤 Files with no reviewable changes (2)
- server/rpc/server.go
- api/types/event.go
🔇 Additional comments (22)
server/backend/pubsub/pubsub_test.go (1)
44-48
: LGTM! Event type transition is properly implemented.The test correctly uses the new
events.DocEvent
type and maintains the original test logic.api/types/events/events.go (1)
58-70
: LGTM! Well-structured event definition.The
DocEvent
struct is well-documented and properly encapsulates all necessary event information.server/backend/pubsub/subscription.go (1)
74-91
: LGTM! Event publishing logic is thread-safe and handles timeouts properly.The Publish method correctly handles concurrency with mutex and includes timeout handling.
server/backend/pubsub/publisher.go (1)
103-109
: LGTM! Efficient debug logging implementation.The code correctly checks the debug level before constructing the log message, which is a performance best practice.
server/backend/pubsub/pubsub.go (4)
26-26
: LGTM!The addition of the
events
package import aligns with the refactoring goals.
64-64
: LGTM!The method signature update to use
events.DocEvent
is consistent with the events package extraction.
178-178
: LGTM!The parameter type update to
events.DocEvent
is consistent with the events package extraction.
184-184
: Verify field name change across codebase.The field name has been changed from
DocumentRefKey
toDocRefKey
. Let's verify this change is consistent across the codebase.✅ Verification successful
Field name change verified across the codebase.
- No instances of the old field name
DocumentRefKey
were found.- All references now correctly use
DocRefKey
, including in the file under review.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Check for any remaining instances of DocumentRefKey # and verify DocRefKey usage # Search for any remaining instances of DocumentRefKey echo "Checking for remaining DocumentRefKey instances:" rg "DocumentRefKey" # Verify DocRefKey usage echo "Verifying DocRefKey usage:" rg "DocRefKey"Length of output: 6287
pkg/webhook/client.go (1)
101-101
: LGTM!Good practice to document potential future improvements. The TODO comment about removing the logging dependency helps track technical debt.
server/packs/packs.go (2)
30-30
: LGTM!The addition of the
events
package import aligns with the refactoring goals.
191-195
: LGTM!The event creation has been correctly updated to use the new events package structure.
server/rpc/admin_server.go (2)
28-28
: LGTM!The addition of the
events
package import aligns with the refactoring goals.
434-438
: LGTM!The event creation has been correctly updated to use the new events package structure.
server/profiling/prometheus/metrics.go (1)
27-28
: LGTM! Clean import update.The addition of the events package import aligns with the PR's objective of extracting event types.
api/converter/to_pb.go (1)
197-210
: LGTM! Clean event type conversion update.The function has been correctly updated to use the new event types while maintaining the same conversion logic.
server/rpc/yorkie_server.go (4)
27-28
: LGTM! Clean import update.The addition of the events package import aligns with the PR's objective.
587-591
: LGTM! Clean event type usage.The DocEvent struct usage has been correctly updated to use the new event types.
612-616
: LGTM! Clean event type usage.The DocEvent struct usage has been correctly updated to use the new event types.
674-682
: LGTM! Clean event type usage.The DocEvent struct usage has been correctly updated to use the new event types.
client/client.go (1)
623-663
: LGTM! Clean event type handling update.The switch cases have been correctly updated to use the new event types while maintaining the same handling logic.
api/converter/from_pb.go (2)
23-23
: LGTM!The import of the new
events
package is correctly placed and follows the project's package structure.
204-214
: LGTM!The function has been correctly updated to use the new
events
package constants while maintaining the same logic and error handling. The changes align with the PR objective of extracting the events package.
What this PR does / why we need it:
Extract DocEvent into events Package
Moved DocEvent from
pubsub
toevents
package to enable broaderintegration possibilities. This change prepares the system for future
webhook and message broker integrations while maintaining existing
pubsub functionality.
Which issue(s) this PR fixes:
Address #1130
Address #1002
Special notes for your reviewer:
Does this PR introduce a user-facing change?:
Additional documentation:
Checklist:
Summary by CodeRabbit
Refactor
Chore