Skip to content

Commit

Permalink
Improve cycling logic for rotateListProjectInfosGreaterThan
Browse files Browse the repository at this point in the history
  • Loading branch information
JongBeom Lee committed Jan 8, 2024
1 parent 7b2f720 commit 51dab2f
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions server/backend/database/memory/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,10 +243,15 @@ func (d *DB) rotateListProjectInfosGreaterThan(
}

var infos []*database.ProjectInfo
isCircular := false

for i := 0; i < pageSize; i++ {
raw := iter.Next()
if raw == nil {
if isCircular {
break
}

iter, err = txn.LowerBound(
tblProjects,
"id",
Expand All @@ -256,10 +261,9 @@ func (d *DB) rotateListProjectInfosGreaterThan(
return nil, fmt.Errorf("fetch projects: %w", err)
}

raw = iter.Next()
if raw == nil {
break
}
i--
isCircular = true
continue
}
info := raw.(*database.ProjectInfo).DeepCopy()

Expand Down

1 comment on commit 51dab2f

@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: 51dab2f Previous: 371c0bd Ratio
BenchmarkDocument/constructor_test - ns/op 1374 ns/op 1377 ns/op 1.00
BenchmarkDocument/constructor_test - B/op 1208 B/op 1208 B/op 1
BenchmarkDocument/constructor_test - allocs/op 20 allocs/op 20 allocs/op 1
BenchmarkDocument/status_test - ns/op 780.1 ns/op 789.4 ns/op 0.99
BenchmarkDocument/status_test - B/op 1176 B/op 1176 B/op 1
BenchmarkDocument/status_test - allocs/op 18 allocs/op 18 allocs/op 1
BenchmarkDocument/equals_test - ns/op 7123 ns/op 7111 ns/op 1.00
BenchmarkDocument/equals_test - B/op 6913 B/op 6913 B/op 1
BenchmarkDocument/equals_test - allocs/op 120 allocs/op 120 allocs/op 1
BenchmarkDocument/nested_update_test - ns/op 18518 ns/op 16193 ns/op 1.14
BenchmarkDocument/nested_update_test - B/op 11963 B/op 11963 B/op 1
BenchmarkDocument/nested_update_test - allocs/op 254 allocs/op 254 allocs/op 1
BenchmarkDocument/delete_test - ns/op 22045 ns/op 21946 ns/op 1.00
BenchmarkDocument/delete_test - B/op 15188 B/op 15188 B/op 1
BenchmarkDocument/delete_test - allocs/op 333 allocs/op 333 allocs/op 1
BenchmarkDocument/object_test - ns/op 8369 ns/op 8312 ns/op 1.01
BenchmarkDocument/object_test - B/op 6721 B/op 6721 B/op 1
BenchmarkDocument/object_test - allocs/op 116 allocs/op 116 allocs/op 1
BenchmarkDocument/array_test - ns/op 28563 ns/op 30000 ns/op 0.95
BenchmarkDocument/array_test - B/op 11819 B/op 11819 B/op 1
BenchmarkDocument/array_test - allocs/op 270 allocs/op 270 allocs/op 1
BenchmarkDocument/text_test - ns/op 30233 ns/op 30139 ns/op 1.00
BenchmarkDocument/text_test - B/op 14796 B/op 14795 B/op 1.00
BenchmarkDocument/text_test - allocs/op 468 allocs/op 468 allocs/op 1
BenchmarkDocument/text_composition_test - ns/op 28425 ns/op 28335 ns/op 1.00
BenchmarkDocument/text_composition_test - B/op 18278 B/op 18276 B/op 1.00
BenchmarkDocument/text_composition_test - allocs/op 477 allocs/op 477 allocs/op 1
BenchmarkDocument/rich_text_test - ns/op 79746 ns/op 79995 ns/op 1.00
BenchmarkDocument/rich_text_test - B/op 38540 B/op 38540 B/op 1
BenchmarkDocument/rich_text_test - allocs/op 1147 allocs/op 1147 allocs/op 1
BenchmarkDocument/counter_test - ns/op 16587 ns/op 16569 ns/op 1.00
BenchmarkDocument/counter_test - B/op 10210 B/op 10210 B/op 1
BenchmarkDocument/counter_test - allocs/op 236 allocs/op 236 allocs/op 1
BenchmarkDocument/text_edit_gc_100 - ns/op 2893118 ns/op 2880237 ns/op 1.00
BenchmarkDocument/text_edit_gc_100 - B/op 1655410 B/op 1655338 B/op 1.00
BenchmarkDocument/text_edit_gc_100 - allocs/op 17094 allocs/op 17093 allocs/op 1.00
BenchmarkDocument/text_edit_gc_1000 - ns/op 228929951 ns/op 230665534 ns/op 0.99
BenchmarkDocument/text_edit_gc_1000 - B/op 144364523 B/op 144353982 B/op 1.00
BenchmarkDocument/text_edit_gc_1000 - allocs/op 200986 allocs/op 200922 allocs/op 1.00
BenchmarkDocument/text_split_gc_100 - ns/op 3347003 ns/op 3364482 ns/op 0.99
BenchmarkDocument/text_split_gc_100 - B/op 2313714 B/op 2313691 B/op 1.00
BenchmarkDocument/text_split_gc_100 - allocs/op 16195 allocs/op 16194 allocs/op 1.00
BenchmarkDocument/text_split_gc_1000 - ns/op 285741510 ns/op 287958336 ns/op 0.99
BenchmarkDocument/text_split_gc_1000 - B/op 228901264 B/op 228907444 B/op 1.00
BenchmarkDocument/text_split_gc_1000 - allocs/op 204025 allocs/op 204038 allocs/op 1.00
BenchmarkDocument/text_delete_all_10000 - ns/op 11118272 ns/op 10745732 ns/op 1.03
BenchmarkDocument/text_delete_all_10000 - B/op 5810575 B/op 5811042 B/op 1.00
BenchmarkDocument/text_delete_all_10000 - allocs/op 40675 allocs/op 40677 allocs/op 1.00
BenchmarkDocument/text_delete_all_100000 - ns/op 180696870 ns/op 182654438 ns/op 0.99
BenchmarkDocument/text_delete_all_100000 - B/op 81898525 B/op 81901874 B/op 1.00
BenchmarkDocument/text_delete_all_100000 - allocs/op 411609 allocs/op 411632 allocs/op 1.00
BenchmarkDocument/text_100 - ns/op 226212 ns/op 233058 ns/op 0.97
BenchmarkDocument/text_100 - B/op 118483 B/op 118483 B/op 1
BenchmarkDocument/text_100 - allocs/op 5080 allocs/op 5080 allocs/op 1
BenchmarkDocument/text_1000 - ns/op 2445627 ns/op 2391484 ns/op 1.02
BenchmarkDocument/text_1000 - B/op 1153070 B/op 1153070 B/op 1
BenchmarkDocument/text_1000 - allocs/op 50084 allocs/op 50084 allocs/op 1
BenchmarkDocument/array_1000 - ns/op 1250047 ns/op 1224286 ns/op 1.02
BenchmarkDocument/array_1000 - B/op 1091313 B/op 1091326 B/op 1.00
BenchmarkDocument/array_1000 - allocs/op 11826 allocs/op 11826 allocs/op 1
BenchmarkDocument/array_10000 - ns/op 12947428 ns/op 13077903 ns/op 0.99
BenchmarkDocument/array_10000 - B/op 9800411 B/op 9800290 B/op 1.00
BenchmarkDocument/array_10000 - allocs/op 120292 allocs/op 120292 allocs/op 1
BenchmarkDocument/array_gc_100 - ns/op 152226 ns/op 151788 ns/op 1.00
BenchmarkDocument/array_gc_100 - B/op 132495 B/op 132488 B/op 1.00
BenchmarkDocument/array_gc_100 - allocs/op 1248 allocs/op 1248 allocs/op 1
BenchmarkDocument/array_gc_1000 - ns/op 1442663 ns/op 1404854 ns/op 1.03
BenchmarkDocument/array_gc_1000 - B/op 1158941 B/op 1158980 B/op 1.00
BenchmarkDocument/array_gc_1000 - allocs/op 12865 allocs/op 12865 allocs/op 1
BenchmarkDocument/counter_1000 - ns/op 208907 ns/op 206194 ns/op 1.01
BenchmarkDocument/counter_1000 - B/op 192852 B/op 192853 B/op 1.00
BenchmarkDocument/counter_1000 - allocs/op 5765 allocs/op 5765 allocs/op 1
BenchmarkDocument/counter_10000 - ns/op 2211850 ns/op 2162242 ns/op 1.02
BenchmarkDocument/counter_10000 - B/op 2087769 B/op 2087767 B/op 1.00
BenchmarkDocument/counter_10000 - allocs/op 59772 allocs/op 59772 allocs/op 1
BenchmarkDocument/object_1000 - ns/op 1411290 ns/op 1387175 ns/op 1.02
BenchmarkDocument/object_1000 - B/op 1428040 B/op 1427873 B/op 1.00
BenchmarkDocument/object_1000 - allocs/op 9845 allocs/op 9844 allocs/op 1.00
BenchmarkDocument/object_10000 - ns/op 15130686 ns/op 14940872 ns/op 1.01
BenchmarkDocument/object_10000 - B/op 12165485 B/op 12167844 B/op 1.00
BenchmarkDocument/object_10000 - allocs/op 100556 allocs/op 100565 allocs/op 1.00
BenchmarkDocument/tree_100 - ns/op 1059144 ns/op 1063528 ns/op 1.00
BenchmarkDocument/tree_100 - B/op 943677 B/op 943676 B/op 1.00
BenchmarkDocument/tree_100 - allocs/op 6099 allocs/op 6099 allocs/op 1
BenchmarkDocument/tree_1000 - ns/op 79104108 ns/op 76919106 ns/op 1.03
BenchmarkDocument/tree_1000 - B/op 86460450 B/op 86460483 B/op 1.00
BenchmarkDocument/tree_1000 - allocs/op 60113 allocs/op 60113 allocs/op 1
BenchmarkDocument/tree_10000 - ns/op 9850995334 ns/op 9455598211 ns/op 1.04
BenchmarkDocument/tree_10000 - B/op 8580660968 B/op 8580974952 B/op 1.00
BenchmarkDocument/tree_10000 - allocs/op 600226 allocs/op 600241 allocs/op 1.00
BenchmarkDocument/tree_delete_all_1000 - ns/op 79644592 ns/op 76041550 ns/op 1.05
BenchmarkDocument/tree_delete_all_1000 - B/op 86990593 B/op 86990093 B/op 1.00
BenchmarkDocument/tree_delete_all_1000 - allocs/op 67750 allocs/op 67750 allocs/op 1
BenchmarkDocument/tree_edit_gc_100 - ns/op 3850903 ns/op 3788184 ns/op 1.02
BenchmarkDocument/tree_edit_gc_100 - B/op 4122075 B/op 4120975 B/op 1.00
BenchmarkDocument/tree_edit_gc_100 - allocs/op 14356 allocs/op 14356 allocs/op 1
BenchmarkDocument/tree_edit_gc_1000 - ns/op 328520352 ns/op 311628432 ns/op 1.05
BenchmarkDocument/tree_edit_gc_1000 - B/op 383465686 B/op 383466072 B/op 1.00
BenchmarkDocument/tree_edit_gc_1000 - allocs/op 145405 allocs/op 145408 allocs/op 1.00
BenchmarkDocument/tree_split_gc_100 - ns/op 2590235 ns/op 2537211 ns/op 1.02
BenchmarkDocument/tree_split_gc_100 - B/op 2386852 B/op 2386834 B/op 1.00
BenchmarkDocument/tree_split_gc_100 - allocs/op 10341 allocs/op 10341 allocs/op 1
BenchmarkDocument/tree_split_gc_1000 - ns/op 195922395 ns/op 186579060 ns/op 1.05
BenchmarkDocument/tree_split_gc_1000 - B/op 221991806 B/op 221992948 B/op 1.00
BenchmarkDocument/tree_split_gc_1000 - allocs/op 112260 allocs/op 112269 allocs/op 1.00
BenchmarkRPC/client_to_server - ns/op 355454746 ns/op 357207335 ns/op 1.00
BenchmarkRPC/client_to_server - B/op 17780621 B/op 17780002 B/op 1.00
BenchmarkRPC/client_to_server - allocs/op 166851 allocs/op 166893 allocs/op 1.00
BenchmarkRPC/client_to_client_via_server - ns/op 607458893 ns/op 609889492 ns/op 1.00
BenchmarkRPC/client_to_client_via_server - B/op 32049872 B/op 36970424 B/op 0.87
BenchmarkRPC/client_to_client_via_server - allocs/op 312460 allocs/op 312196 allocs/op 1.00
BenchmarkRPC/attach_large_document - ns/op 1237476310 ns/op 1311110292 ns/op 0.94
BenchmarkRPC/attach_large_document - B/op 1888399680 B/op 1890028136 B/op 1.00
BenchmarkRPC/attach_large_document - allocs/op 7499 allocs/op 7522 allocs/op 1.00
BenchmarkRPC/adminCli_to_server - ns/op 534579910 ns/op 542890036 ns/op 0.98
BenchmarkRPC/adminCli_to_server - B/op 36397928 B/op 35988828 B/op 1.01
BenchmarkRPC/adminCli_to_server - allocs/op 289696 allocs/op 289666 allocs/op 1.00
BenchmarkLocker - ns/op 66.9 ns/op 68.75 ns/op 0.97
BenchmarkLocker - B/op 16 B/op 16 B/op 1
BenchmarkLocker - allocs/op 1 allocs/op 1 allocs/op 1
BenchmarkLockerParallel - ns/op 39.87 ns/op 40.48 ns/op 0.98
BenchmarkLockerParallel - B/op 0 B/op 0 B/op NaN
BenchmarkLockerParallel - allocs/op 0 allocs/op 0 allocs/op NaN
BenchmarkLockerMoreKeys - ns/op 148.8 ns/op 147.6 ns/op 1.01
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 3763514 ns/op 3805155 ns/op 0.99
BenchmarkChange/Push_10_Changes - B/op 126182 B/op 126109 B/op 1.00
BenchmarkChange/Push_10_Changes - allocs/op 1255 allocs/op 1248 allocs/op 1.01
BenchmarkChange/Push_100_Changes - ns/op 14024082 ns/op 14183166 ns/op 0.99
BenchmarkChange/Push_100_Changes - B/op 647204 B/op 642196 B/op 1.01
BenchmarkChange/Push_100_Changes - allocs/op 6539 allocs/op 6533 allocs/op 1.00
BenchmarkChange/Push_1000_Changes - ns/op 112575369 ns/op 113839698 ns/op 0.99
BenchmarkChange/Push_1000_Changes - B/op 6190187 B/op 6143264 B/op 1.01
BenchmarkChange/Push_1000_Changes - allocs/op 62165 allocs/op 62159 allocs/op 1.00
BenchmarkChange/Pull_10_Changes - ns/op 2824679 ns/op 2849854 ns/op 0.99
BenchmarkChange/Pull_10_Changes - B/op 100755 B/op 100526 B/op 1.00
BenchmarkChange/Pull_10_Changes - allocs/op 952 allocs/op 952 allocs/op 1
BenchmarkChange/Pull_100_Changes - ns/op 4291552 ns/op 4343669 ns/op 0.99
BenchmarkChange/Pull_100_Changes - B/op 258141 B/op 257709 B/op 1.00
BenchmarkChange/Pull_100_Changes - allocs/op 3154 allocs/op 3154 allocs/op 1
BenchmarkChange/Pull_1000_Changes - ns/op 8152425 ns/op 8312148 ns/op 0.98
BenchmarkChange/Pull_1000_Changes - B/op 1396513 B/op 1399193 B/op 1.00
BenchmarkChange/Pull_1000_Changes - allocs/op 26876 allocs/op 26872 allocs/op 1.00
BenchmarkSnapshot/Push_3KB_snapshot - ns/op 16659215 ns/op 16961319 ns/op 0.98
BenchmarkSnapshot/Push_3KB_snapshot - B/op 803087 B/op 808475 B/op 0.99
BenchmarkSnapshot/Push_3KB_snapshot - allocs/op 6541 allocs/op 6543 allocs/op 1.00
BenchmarkSnapshot/Push_30KB_snapshot - ns/op 117349964 ns/op 118594721 ns/op 0.99
BenchmarkSnapshot/Push_30KB_snapshot - B/op 6278505 B/op 6352788 B/op 0.99
BenchmarkSnapshot/Push_30KB_snapshot - allocs/op 62173 allocs/op 62161 allocs/op 1.00
BenchmarkSnapshot/Pull_3KB_snapshot - ns/op 6477564 ns/op 6716744 ns/op 0.96
BenchmarkSnapshot/Pull_3KB_snapshot - B/op 906099 B/op 904978 B/op 1.00
BenchmarkSnapshot/Pull_3KB_snapshot - allocs/op 14882 allocs/op 14877 allocs/op 1.00
BenchmarkSnapshot/Pull_30KB_snapshot - ns/op 14739692 ns/op 15139900 ns/op 0.97
BenchmarkSnapshot/Pull_30KB_snapshot - B/op 6978914 B/op 6988512 B/op 1.00
BenchmarkSnapshot/Pull_30KB_snapshot - allocs/op 144140 allocs/op 144138 allocs/op 1.00
BenchmarkSync/memory_sync_10_test - ns/op 6732 ns/op 6857 ns/op 0.98
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 50956 ns/op 52028 ns/op 0.98
BenchmarkSync/memory_sync_100_test - B/op 8657 B/op 8648 B/op 1.00
BenchmarkSync/memory_sync_100_test - allocs/op 274 allocs/op 273 allocs/op 1.00
BenchmarkSync/memory_sync_1000_test - ns/op 587074 ns/op 589322 ns/op 1.00
BenchmarkSync/memory_sync_1000_test - B/op 74559 B/op 74649 B/op 1.00
BenchmarkSync/memory_sync_1000_test - allocs/op 2123 allocs/op 2127 allocs/op 1.00
BenchmarkSync/memory_sync_10000_test - ns/op 7265098 ns/op 7070870 ns/op 1.03
BenchmarkSync/memory_sync_10000_test - B/op 758974 B/op 756421 B/op 1.00
BenchmarkSync/memory_sync_10000_test - allocs/op 20511 allocs/op 20513 allocs/op 1.00
BenchmarkTextEditing - ns/op 18451209862 ns/op 18441616550 ns/op 1.00
BenchmarkTextEditing - B/op 9037770040 B/op 9037573648 B/op 1.00
BenchmarkTextEditing - allocs/op 19922704 allocs/op 19921799 allocs/op 1.00

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

Please sign in to comment.