Skip to content

Introduce EventTimingControl Package with Throttling and Debouncing#1166

Merged
hackerwins merged 39 commits into
mainfrom
rate-limiter
Mar 12, 2025
Merged

Introduce EventTimingControl Package with Throttling and Debouncing#1166
hackerwins merged 39 commits into
mainfrom
rate-limiter

Conversation

@window9u

@window9u window9u commented Feb 22, 2025

Copy link
Copy Markdown
Member

What this PR does / why we need it:

We previously introduced an event webhook for the DocRootChanged event. However, there were two major issues:

  1. Frequency:
    The DocRootChanged event is fired too frequently, which necessitates throttling.

  2. Eventual Consistency:
    Throttling alone does not guarantee that endpoints receive the most up-to-date state. For example, if the throttle window is 5 seconds and:

    • An event occurs at e1 (0s) and then at e2 (3s),
    • Only the e1 webhook is triggered,

    then the endpoints remain unaware of the e2 event. To ensure that when an endpoint receives the last webhook it truly reflects that the document has not changed, we must address this gap.

Limiter Operation Phases

The limiter operates in three phases:

1. Operation Phase

This phase covers various event scenarios, which are also reflected in our test code (TestThrottlerBehavior in pkg/limit/limiter_test.go). The scenarios include:

  • Scenario 1: Single Event (e1)
    image A single event is processed immediately.

  • Scenario 2: Two Events (e1 followed by e2)
    image e1 is executed, while e2 is scheduled.

  • Scenario 3: Three Events (e1, e2, e3) → e1 and e3 executed
    image e2 is debounced, ensuring only the first and the latest events are executed.

  • Scenario 4: Four Events (e1, e2, e3, then e4) → e1 and e4 executed
    image Only the first event (e1) and the last event (e4) are executed.

  • Scenario 5: Five Events (e1, e2, e3, then e4, e5) → e1, e4, and e5 executed
    image The sequence ensures that only the key events are executed based on the debounce logic.

2. Expire Batch Phase

image

In this phase, scheduled events that have not yet been executed are grouped into a batch. This ensures that no event is lost even if it was debounced for a short period.

3. Closing Phase

image

When a closing event occurs (for example, during a graceful shutdown), the limiter immediately flushes all remaining events instead of waiting for the debouncing delay. This guarantees that endpoints receive all necessary updates before the system shuts down.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Webhook Benchmark Results

Performance Improvements

Implementing throttling for webhook sending drastically reduces execution time, memory usage, and the number of allocations. Consider the following example:

  • Scenario: Sending 100 webhooks to 100 endpoints
    • Without throttling:
      • Execution Time: 1.42 seconds
      • Memory Usage: 83 MB
    • With throttling:
      • Execution Time: 28 ms
      • Memory Usage: 3 MB

Key Insights:

  • Memory Efficiency:
    The memory usage becomes trivial when using the rate limiter.

  • Connection Reuse:
    Fewer endpoints triggering multiple webhooks is better than many endpoints triggering fewer webhooks because a single endpoint can reuse TCP connections, reducing overhead.

  • Scalability:
    The performance scales non-linearly with an increasing number of webhooks and endpoints. For example, sending 100 webhooks to 100 endpoints (without limits) consumes significantly more resources than sending 100 webhooks to 10 endpoints.

    This disparity is likely due to the use of the default HTTP client and its DefaultTransport settings, particularly the MaxIdleConns limit, which is set to 100.

    If this becomes a bottleneck, tuning these parameters might be necessary. However, current performance is deemed acceptable.


Default HTTP Transport Configuration

The default HTTP transport is configured as follows:

var DefaultTransport RoundTripper = &Transport{
    Proxy: ProxyFromEnvironment,
    DialContext: defaultTransportDialContext(&net.Dialer{
       Timeout:   30 * time.Second,
       KeepAlive: 30 * time.Second,
    }),
    ForceAttemptHTTP2:     true,
    MaxIdleConns:          100,
    IdleConnTimeout:       90 * time.Second,
    TLSHandshakeTimeout:   10 * time.Second,
    ExpectContinueTimeout: 1 * time.Second,
}

System Information

OS Architecture CPU
Windows AMD64 11th Gen Intel Core i7-1195G7 @ 2.90GHz

Detailed Benchmark Results

1. Webhook Sending Without Throttling

Test Scenario Runs Time per Operation Memory Allocated Allocations
Send 10 webhooks to 10 endpoints 97 12.50 ms 848 KB 10,327
Send 100 webhooks to 10 endpoints 10 111.86 ms 8.37 MB 103,221
Send 10 webhooks to 100 endpoints 8 128.98 ms 8.49 MB 104,513
Send 100 webhooks to 100 endpoints 1 1.19 s 84.68 MB 1,042,436
Send 10 webhooks to 1000 endpoints 1 7.14 s 226.99 MB 1,796,022

2. Webhook Sending With Throttling

Test Scenario Runs Time per Operation Memory Allocated Allocations
Send 10 webhooks to 10 endpoints (limited) 367 2.90 ms 188 KB 2,299
Send 100 webhooks to 10 endpoints (limited) 326 3.09 ms 312 KB 4,101
Send 10 webhooks to 100 endpoints (limited) 38 27.70 ms 1.89 MB 23,144
Send 100 webhooks to 100 endpoints (limited) 33 30.30 ms 3.19 MB 41,191
Send 10 webhooks to 1000 endpoints (limited) 1 1.06 s 50.90 MB 422,858

Does this PR introduce a user-facing change?:


Additional documentation:


Checklist:

  • Added relevant tests or not required
  • Addressed and resolved all CodeRabbit review comments
  • Didn't break anything

Summary by CodeRabbit

  • New Features

    • Enhanced webhook event handling with standardized timestamps, structured metadata, and consolidated request composition.
    • Introduced a rate-limiting mechanism to control rapid event dispatch for improved performance.
    • Added benchmarking capabilities for webhook sending operations.
  • Refactor

    • Streamlined backend webhook integration, replacing deprecated event sending methods with a unified management approach.
    • Refactored signature verification logic into a helper function for better maintainability.
  • Tests

    • Expanded integration tests to validate event throttling and ensure proper shutdown behavior.
    • Introduced comprehensive unit tests for the throttler's behavior and performance under various conditions.

@window9u window9u requested a review from hackerwins February 22, 2025 09:50
@window9u window9u self-assigned this Feb 22, 2025
@coderabbitai

coderabbitai Bot commented Feb 22, 2025

Copy link
Copy Markdown

Walkthrough

This pull request introduces extensive changes for managing webhook events. New types and functions are added to build standardized webhook request payloads and metadata. A token bucket mechanism is implemented for rate limiting, with accompanying improvements to goroutine synchronization. The backend has been refactored to replace the direct usage of a webhook client with a dedicated event manager, and related integration tests have been updated accordingly. Additionally, legacy webhook event handling code has been removed.

Changes

File(s) Change Summary
api/types/event_webhook.go, api/types/resource_ref_key.go Added new constants (DateFormat), types (EventWebhookRequest, EventWebhookInfo, WebhookAttribute, EventRefKey), and utility functions for constructing JSON payloads and string representations for webhook events.
pkg/limit/bucket.go, pkg/limit/limiter.go, pkg/limit/limiter_test.go Introduced a token bucket-based rate limiting mechanism, synchronized goroutines using a WaitGroup, and provided comprehensive unit tests to validate throttler behavior.
server/backend/backend.go, server/backend/webhook/manager.go, server/packs/packs.go Refactored webhook event integration: updated webhook client imports, transitioned to using a dedicated EventWebhookManager for rate-limited dispatch, and modified event sending logic to use an encapsulated event info structure.
server/webhook/events.go Removed legacy file containing the previous implementation of webhook event dispatch and associated helper functions.
test/integration/event_webhook_test.go Updated integration tests: merged registration/unregistration scenarios, renamed tests (e.g., from caching to throttling), and added cases for verifying manager shutdown behavior.
pkg/webhook/client_test.go Removed verifySignature function and replaced it with a call to helper.VerifySignature.
test/bench/webhook_bench_test.go Introduced a new benchmark test file for performance testing of webhook sending operations.
test/helper/helper.go Added a new function, VerifySignature, for HMAC signature verification in the helper package.

Sequence Diagram(s)

sequenceDiagram
    participant Packs as Server/Packs
    participant Backend as Backend
    participant Manager as EventWebhookManager
    participant Limiter as TokenBucket
    participant Client as pkgwebhook.Client
    participant HTTP as Webhook Endpoint

    Packs->>Backend: Create EventWebhookInfo
    Backend->>Manager: Send(EventWebhookInfo)
    Manager->>Limiter: Check if allowed
    Limiter-->>Manager: Allow/Block token
    Manager->>Client: Construct JSON payload via NewRequestBody
    Client->>HTTP: Send webhook request
    HTTP-->>Client: Return HTTP response
    Client-->>Manager: Return response status
    Manager-->>Backend: Return result
Loading

Possibly related PRs

Suggested reviewers

  • hackerwins
✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@hackerwins-yorkie hackerwins-yorkie left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Go Benchmark Analysis 📊

This is a comparison result between the previous(e687d61) and the current commit(d8cf598).

Significant Changes (≥20% difference)

Nothing

Key Observations 🔍

  • The following benchmark suites showed significant changes (≥20% difference) in their performance:
    • BenchmarkVersionVector for clients_1000 experienced a notable improvement with a decrease in the execution time by 1.18% and a reduction in memory allocation by 0.01%.
  • While there were no significant changes in other benchmark suites, several benchmarks showed slight improvements (🟢) or regressions (🔴) in performance, highlighting the ongoing optimization efforts in the codebase.
  • Overall, the benchmarks demonstrate consistent performance with minor fluctuations, indicating a stable and efficient implementation that can still benefit from occasional optimizations to maintain or enhance performance levels.

Detailed Test Results

BenchmarkDocument
Benchmark suite Previous Current Change
constructor_test/ (ns/op) 1439.00 ns 1440.00 ns 🔴 +0.07%
constructor_test/ (B/op) 1.39 KB 1.39 KB ⚪ 0%
constructor_test/ (allocs/op) 24 allocs 24 allocs ⚪ 0%
status_test/ (ns/op) 1028.00 ns 1020.00 ns 🟢 -0.78%
status_test/ (B/op) 1.35 KB 1.35 KB ⚪ 0%
status_test/ (allocs/op) 22 allocs 22 allocs ⚪ 0%
equals_test/ (ns/op) 7864.00 ns 7761.00 ns 🟢 -1.31%
equals_test/ (B/op) 7.56 KB 7.56 KB ⚪ 0%
equals_test/ (allocs/op) 129 allocs 129 allocs ⚪ 0%
nested_update_test/ (ns/op) 17079.00 ns 16805.00 ns 🟢 -1.60%
nested_update_test/ (B/op) 12.31 KB 12.31 KB ⚪ 0%
nested_update_test/ (allocs/op) 258 allocs 258 allocs ⚪ 0%
delete_test/ (ns/op) 27313.00 ns 26265.00 ns 🟢 -3.84%
delete_test/ (B/op) 15.79 KB 15.79 KB 🟢 -0.01%
delete_test/ (allocs/op) 339 allocs 339 allocs ⚪ 0%
object_test/ (ns/op) 8546.00 ns 8579.00 ns 🔴 +0.39%
object_test/ (B/op) 7.03 KB 7.03 KB 🔴 +0.01%
object_test/ (allocs/op) 118 allocs 118 allocs ⚪ 0%
array_test/ (ns/op) 28984.00 ns 28617.00 ns 🟢 -1.27%
array_test/ (B/op) 12.14 KB 12.14 KB ⚪ 0%
array_test/ (allocs/op) 273 allocs 273 allocs ⚪ 0%
text_test/ (ns/op) 32155.00 ns 31934.00 ns 🟢 -0.69%
text_test/ (B/op) 15.19 KB 15.19 KB ⚪ 0%
text_test/ (allocs/op) 484 allocs 484 allocs ⚪ 0%
text_composition_test/ (ns/op) 31674.00 ns 31689.00 ns 🔴 +0.05%
text_composition_test/ (B/op) 18.70 KB 18.70 KB ⚪ 0%
text_composition_test/ (allocs/op) 501 allocs 501 allocs ⚪ 0%
rich_text_test/ (ns/op) 87424.00 ns 86468.00 ns 🟢 -1.09%
rich_text_test/ (B/op) 39.36 KB 39.36 KB ⚪ 0%
rich_text_test/ (allocs/op) 1,146 allocs 1,146 allocs ⚪ 0%
counter_test/ (ns/op) 18201.00 ns 18087.00 ns 🟢 -0.63%
counter_test/ (B/op) 11.81 KB 11.81 KB ⚪ 0%
counter_test/ (allocs/op) 253 allocs 253 allocs ⚪ 0%
text_edit_gc_100/ (ns/op) 1.39 ms 1.38 ms 🟢 -0.43%
text_edit_gc_100/ (B/op) 864.90 KB 864.95 KB ⚪ 0%
text_edit_gc_100/ (allocs/op) 17,281 allocs 17,282 allocs ⚪ 0%
text_edit_gc_1000/ (ns/op) 53.39 ms 53.14 ms 🟢 -0.47%
text_edit_gc_1000/ (B/op) 46.84 MB 46.84 MB ⚪ 0%
text_edit_gc_1000/ (allocs/op) 185,598 allocs 185,591 allocs ⚪ 0%
text_split_gc_100/ (ns/op) 2.12 ms 2.11 ms 🟢 -0.50%
text_split_gc_100/ (B/op) 1.58 MB 1.58 MB ⚪ 0%
text_split_gc_100/ (allocs/op) 15,950 allocs 15,951 allocs ⚪ 0%
text_split_gc_1000/ (ns/op) 128.25 ms 127.50 ms 🟢 -0.58%
text_split_gc_1000/ (B/op) 137.79 MB 137.79 MB ⚪ 0%
text_split_gc_1000/ (allocs/op) 185,000 allocs 185,004 allocs ⚪ 0%
text_delete_all_10000/ (ns/op) 18.43 ms 16.35 ms 🟢 -11.29%
text_delete_all_10000/ (B/op) 10.58 MB 10.58 MB 🔴 +0.02%
text_delete_all_10000/ (allocs/op) 56,134 allocs 56,140 allocs 🔴 +0.01%
text_delete_all_100000/ (ns/op) 312.31 ms 276.68 ms 🟢 -11.41%
text_delete_all_100000/ (B/op) 105.54 MB 105.52 MB 🟢 -0.02%
text_delete_all_100000/ (allocs/op) 566,133 allocs 566,066 allocs 🟢 -0.01%
text_100/ (ns/op) 234634.00 ns 232480.00 ns 🟢 -0.92%
text_100/ (B/op) 120.94 KB 120.91 KB 🟢 -0.03%
text_100/ (allocs/op) 5,181 allocs 5,181 allocs ⚪ 0%
text_1000/ (ns/op) 2.46 ms 2.46 ms 🟢 -0.19%
text_1000/ (B/op) 1.16 MB 1.16 MB ⚪ 0%
text_1000/ (allocs/op) 51,084 allocs 51,084 allocs ⚪ 0%
array_1000/ (ns/op) 1.24 ms 1.23 ms 🟢 -0.56%
array_1000/ (B/op) 1.09 MB 1.09 MB ⚪ 0%
array_1000/ (allocs/op) 11,879 allocs 11,879 allocs ⚪ 0%
array_10000/ (ns/op) 13.33 ms 13.29 ms 🟢 -0.35%
array_10000/ (B/op) 9.89 MB 9.89 MB 🟢 -0.02%
array_10000/ (allocs/op) 120,735 allocs 120,729 allocs ⚪ 0%
array_gc_100/ (ns/op) 131750.00 ns 132133.00 ns 🔴 +0.29%
array_gc_100/ (B/op) 99.89 KB 99.88 KB 🟢 -0.02%
array_gc_100/ (allocs/op) 1,266 allocs 1,266 allocs ⚪ 0%
array_gc_1000/ (ns/op) 1.42 ms 1.42 ms 🟢 -0.30%
array_gc_1000/ (B/op) 1.14 MB 1.14 MB ⚪ 0%
array_gc_1000/ (allocs/op) 12,926 allocs 12,927 allocs ⚪ 0%
counter_1000/ (ns/op) 202098.00 ns 201524.00 ns 🟢 -0.28%
counter_1000/ (B/op) 178.13 KB 178.14 KB ⚪ 0%
counter_1000/ (allocs/op) 5,771 allocs 5,771 allocs ⚪ 0%
counter_10000/ (ns/op) 2.17 ms 2.16 ms 🟢 -0.50%
counter_10000/ (B/op) 2.07 MB 2.07 MB ⚪ 0%
counter_10000/ (allocs/op) 59,778 allocs 59,778 allocs ⚪ 0%
object_1000/ (ns/op) 1.39 ms 1.39 ms 🔴 +0.13%
object_1000/ (B/op) 1.44 MB 1.44 MB ⚪ 0%
object_1000/ (allocs/op) 9,925 allocs 9,924 allocs 🟢 -0.01%
object_10000/ (ns/op) 14.82 ms 14.57 ms 🟢 -1.69%
object_10000/ (B/op) 12.35 MB 12.35 MB ⚪ 0%
object_10000/ (allocs/op) 101,232 allocs 101,237 allocs ⚪ 0%
tree_100/ (ns/op) 1.02 ms 1.02 ms 🟢 -0.57%
tree_100/ (B/op) 951.02 KB 951.03 KB ⚪ 0%
tree_100/ (allocs/op) 6,102 allocs 6,102 allocs ⚪ 0%
tree_1000/ (ns/op) 74.23 ms 74.53 ms 🔴 +0.40%
tree_1000/ (B/op) 86.58 MB 86.58 MB ⚪ 0%
tree_1000/ (allocs/op) 60,111 allocs 60,112 allocs ⚪ 0%
tree_10000/ (ns/op) 9.68 s 9.37 s 🟢 -3.21%
tree_10000/ (B/op) 8.58 GB 8.58 GB ⚪ 0%
tree_10000/ (allocs/op) 600,173 allocs 600,200 allocs ⚪ 0%
tree_delete_all_1000/ (ns/op) 78.41 ms 79.33 ms 🔴 +1.17%
tree_delete_all_1000/ (B/op) 87.57 MB 87.57 MB ⚪ 0%
tree_delete_all_1000/ (allocs/op) 75,289 allocs 75,291 allocs ⚪ 0%
tree_edit_gc_100/ (ns/op) 3.96 ms 3.88 ms 🟢 -1.94%
tree_edit_gc_100/ (B/op) 4.15 MB 4.15 MB ⚪ 0%
tree_edit_gc_100/ (allocs/op) 15,147 allocs 15,146 allocs ⚪ 0%
tree_edit_gc_1000/ (ns/op) 332.75 ms 318.75 ms 🟢 -4.21%
tree_edit_gc_1000/ (B/op) 384.04 MB 384.04 MB ⚪ 0%
tree_edit_gc_1000/ (allocs/op) 154,952 allocs 154,947 allocs ⚪ 0%
tree_split_gc_100/ (ns/op) 2.67 ms 2.65 ms 🟢 -0.72%
tree_split_gc_100/ (B/op) 2.41 MB 2.41 MB ⚪ 0%
tree_split_gc_100/ (allocs/op) 11,131 allocs 11,131 allocs ⚪ 0%
tree_split_gc_1000/ (ns/op) 197.74 ms 197.46 ms 🟢 -0.14%
tree_split_gc_1000/ (B/op) 222.50 MB 222.50 MB ⚪ 0%
tree_split_gc_1000/ (allocs/op) 122,053 allocs 122,073 allocs 🔴 +0.02%
BenchmarkRPC
Benchmark suite Previous Current Change
client_to_server/ (ns/op) 431.85 ms 419.06 ms 🟢 -2.96%
client_to_server/ (B/op) 16.13 MB 16.13 MB 🔴 +0.01%
client_to_server/ (allocs/op) 223,674 allocs 223,558 allocs 🟢 -0.05%
client_to_client_via_server/ (ns/op) 788.62 ms 782.83 ms 🟢 -0.73%
client_to_client_via_server/ (B/op) 37.20 MB 39.02 MB 🔴 +4.90%
client_to_client_via_server/ (allocs/op) 478,656 allocs 477,760 allocs 🟢 -0.19%
attach_large_document/ (ns/op) 1.32 s 1.28 s 🟢 -2.98%
attach_large_document/ (B/op) 1.89 GB 1.90 GB 🔴 +0.56%
attach_large_document/ (allocs/op) 12,321 allocs 12,662 allocs 🔴 +2.77%
adminCli_to_server/ (ns/op) 542.08 ms 542.43 ms 🔴 +0.06%
adminCli_to_server/ (B/op) 21.76 MB 21.30 MB 🟢 -2.11%
adminCli_to_server/ (allocs/op) 291,952 allocs 316,690 allocs 🔴 +8.47%
BenchmarkLocker
Benchmark suite Previous Current Change
(ns/op) 82.86 ns 80.69 ns 🟢 -2.62%
(B/op) 32.00 B 32.00 B ⚪ 0%
(allocs/op) 1 allocs 1 allocs ⚪ 0%
BenchmarkLockerParallel
Benchmark suite Previous Current Change
(ns/op) 45.80 ns 44.64 ns 🟢 -2.53%
(B/op) 0.00 B 0.00 B ⚪ 0%
(allocs/op) 0 allocs 0 allocs ⚪ 0%
BenchmarkLockerMoreKeys
Benchmark suite Previous Current Change
(ns/op) 180.50 ns 179.40 ns 🟢 -0.61%
(B/op) 31.00 B 30.00 B 🟢 -3.23%
(allocs/op) 0 allocs 0 allocs ⚪ 0%
BenchmarkRWLocker
Benchmark suite Previous Current Change
RWLock_rate_2/ (ns/op) 50.25 ns 49.30 ns 🟢 -1.89%
RWLock_rate_2/ (B/op) 0.00 B 0.00 B ⚪ 0%
RWLock_rate_2/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
RWLock_rate_10/ (ns/op) 44.88 ns 42.58 ns 🟢 -5.12%
RWLock_rate_10/ (B/op) 0.00 B 0.00 B ⚪ 0%
RWLock_rate_10/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
RWLock_rate_100/ (ns/op) 63.08 ns 59.00 ns 🟢 -6.47%
RWLock_rate_100/ (B/op) 2.00 B 2.00 B ⚪ 0%
RWLock_rate_100/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
RWLock_rate_1000/ (ns/op) 91.91 ns 87.07 ns 🟢 -5.27%
RWLock_rate_1000/ (B/op) 8.00 B 8.00 B ⚪ 0%
RWLock_rate_1000/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
BenchmarkChange
Benchmark suite Previous Current Change
Push_10_Changes/ (ns/op) 4.54 ms 4.51 ms 🟢 -0.66%
Push_10_Changes/ (B/op) 150.42 KB 150.52 KB 🔴 +0.07%
Push_10_Changes/ (allocs/op) 1,623 allocs 1,623 allocs ⚪ 0%
Push_100_Changes/ (ns/op) 16.52 ms 16.49 ms 🟢 -0.18%
Push_100_Changes/ (B/op) 770.59 KB 779.02 KB 🔴 +1.09%
Push_100_Changes/ (allocs/op) 8,509 allocs 8,509 allocs ⚪ 0%
Push_1000_Changes/ (ns/op) 129.20 ms 131.66 ms 🔴 +1.91%
Push_1000_Changes/ (B/op) 7.22 MB 7.31 MB 🔴 +1.32%
Push_1000_Changes/ (allocs/op) 79,325 allocs 79,324 allocs ⚪ 0%
Pull_10_Changes/ (ns/op) 3.70 ms 3.69 ms 🟢 -0.42%
Pull_10_Changes/ (B/op) 124.59 KB 124.80 KB 🔴 +0.17%
Pull_10_Changes/ (allocs/op) 1,456 allocs 1,456 allocs ⚪ 0%
Pull_100_Changes/ (ns/op) 5.32 ms 5.25 ms 🟢 -1.49%
Pull_100_Changes/ (B/op) 354.61 KB 354.84 KB 🔴 +0.06%
Pull_100_Changes/ (allocs/op) 5,182 allocs 5,181 allocs 🟢 -0.02%
Pull_1000_Changes/ (ns/op) 10.88 ms 10.69 ms 🟢 -1.67%
Pull_1000_Changes/ (B/op) 2.20 MB 2.20 MB ⚪ 0%
Pull_1000_Changes/ (allocs/op) 44,681 allocs 44,683 allocs ⚪ 0%
BenchmarkSnapshot
Benchmark suite Previous Current Change
Push_3KB_snapshot/ (ns/op) 19.55 ms 18.99 ms 🟢 -2.88%
Push_3KB_snapshot/ (B/op) 905.58 KB 903.70 KB 🟢 -0.21%
Push_3KB_snapshot/ (allocs/op) 8,516 allocs 8,512 allocs 🟢 -0.05%
Push_30KB_snapshot/ (ns/op) 132.18 ms 137.19 ms 🔴 +3.79%
Push_30KB_snapshot/ (B/op) 8.24 MB 8.25 MB 🔴 +0.13%
Push_30KB_snapshot/ (allocs/op) 89,008 allocs 89,960 allocs 🔴 +1.07%
Pull_3KB_snapshot/ (ns/op) 7.80 ms 7.43 ms 🟢 -4.82%
Pull_3KB_snapshot/ (B/op) 1.12 MB 1.12 MB 🔴 +0.04%
Pull_3KB_snapshot/ (allocs/op) 20,064 allocs 20,066 allocs ⚪ 0%
Pull_30KB_snapshot/ (ns/op) 19.91 ms 19.65 ms 🟢 -1.33%
Pull_30KB_snapshot/ (B/op) 9.31 MB 9.31 MB 🔴 +0.02%
Pull_30KB_snapshot/ (allocs/op) 193,610 allocs 193,605 allocs ⚪ 0%
BenchmarkSplayTree
Benchmark suite Previous Current Change
stress_test_100000/ (ns/op) 0.19 ns 0.19 ns 🟢 -2.48%
stress_test_100000/ (B/op) 0.00 B 0.00 B ⚪ 0%
stress_test_100000/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
stress_test_200000/ (ns/op) 0.40 ns 0.37 ns 🟢 -5.47%
stress_test_200000/ (B/op) 0.00 B 0.00 B ⚪ 0%
stress_test_200000/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
stress_test_300000/ (ns/op) 0.57 ns 0.57 ns 🟢 -0.28%
stress_test_300000/ (B/op) 0.00 B 0.00 B ⚪ 0%
stress_test_300000/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
random_access_100000/ (ns/op) 0.01 ns 0.01 ns 🟢 -1.65%
random_access_100000/ (B/op) 0.00 B 0.00 B ⚪ 0%
random_access_100000/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
random_access_200000/ (ns/op) 0.03 ns 0.03 ns 🟢 -2.83%
random_access_200000/ (B/op) 0.00 B 0.00 B ⚪ 0%
random_access_200000/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
random_access_300000/ (ns/op) 0.04 ns 0.04 ns 🟢 -4.57%
random_access_300000/ (B/op) 0.00 B 0.00 B ⚪ 0%
random_access_300000/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
editing_trace_bench/ (ns/op) 0.00 ns 0.00 ns 🟢 -9.27%
editing_trace_bench/ (B/op) 0.00 B 0.00 B ⚪ 0%
editing_trace_bench/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
BenchmarkSync
Benchmark suite Previous Current Change
memory_sync_10_test/ (ns/op) 7288.00 ns 7183.00 ns 🟢 -1.44%
memory_sync_10_test/ (B/op) 1.34 KB 1.34 KB 🔴 +0.07%
memory_sync_10_test/ (allocs/op) 35 allocs 35 allocs ⚪ 0%
memory_sync_100_test/ (ns/op) 55353.00 ns 55409.00 ns 🔴 +0.10%
memory_sync_100_test/ (B/op) 9.51 KB 9.51 KB 🔴 +0.03%
memory_sync_100_test/ (allocs/op) 268 allocs 268 allocs ⚪ 0%
memory_sync_1000_test/ (ns/op) 616285.00 ns 615204.00 ns 🟢 -0.18%
memory_sync_1000_test/ (B/op) 75.92 KB 75.73 KB 🟢 -0.25%
memory_sync_1000_test/ (allocs/op) 2,111 allocs 2,105 allocs 🟢 -0.28%
memory_sync_10000_test/ (ns/op) 7.47 ms 7.76 ms 🔴 +3.85%
memory_sync_10000_test/ (B/op) 761.49 KB 762.99 KB 🔴 +0.20%
memory_sync_10000_test/ (allocs/op) 20,475 allocs 20,512 allocs 🔴 +0.18%
BenchmarkTextEditing
Benchmark suite Previous Current Change
(ns/op) 5.18 s 5.11 s 🟢 -1.28%
(B/op) 3.92 GB 3.92 GB ⚪ 0%
(allocs/op) 20,619,777 allocs 20,619,802 allocs ⚪ 0%
BenchmarkTree
Benchmark suite Previous Current Change
10000_vertices_to_protobuf/ (ns/op) 4.17 ms 4.25 ms 🔴 +1.87%
10000_vertices_to_protobuf/ (B/op) 6.36 MB 6.36 MB ⚪ 0%
10000_vertices_to_protobuf/ (allocs/op) 70,025 allocs 70,025 allocs ⚪ 0%
10000_vertices_from_protobuf/ (ns/op) 217.30 ms 226.86 ms 🔴 +4.40%
10000_vertices_from_protobuf/ (B/op) 442.30 MB 442.30 MB ⚪ 0%
10000_vertices_from_protobuf/ (allocs/op) 290,038 allocs 290,039 allocs ⚪ 0%
20000_vertices_to_protobuf/ (ns/op) 8.84 ms 9.26 ms 🔴 +4.81%
20000_vertices_to_protobuf/ (B/op) 12.89 MB 12.89 MB ⚪ 0%
20000_vertices_to_protobuf/ (allocs/op) 140,028 allocs 140,028 allocs ⚪ 0%
20000_vertices_from_protobuf/ (ns/op) 884.61 ms 894.81 ms 🔴 +1.15%
20000_vertices_from_protobuf/ (B/op) 1.70 GB 1.70 GB ⚪ 0%
20000_vertices_from_protobuf/ (allocs/op) 580,043 allocs 580,045 allocs ⚪ 0%
30000_vertices_to_protobuf/ (ns/op) 14.26 ms 13.54 ms 🟢 -5.03%
30000_vertices_to_protobuf/ (B/op) 18.98 MB 18.98 MB ⚪ 0%
30000_vertices_to_protobuf/ (allocs/op) 210,029 allocs 210,029 allocs ⚪ 0%
30000_vertices_from_protobuf/ (ns/op) 2.00 s 2.03 s 🔴 +1.63%
30000_vertices_from_protobuf/ (B/op) 3.75 GB 3.75 GB ⚪ 0%
30000_vertices_from_protobuf/ (allocs/op) 870,147 allocs 870,142 allocs ⚪ 0%
BenchmarkVersionVector
Benchmark suite Previous Current Change
clients_10/ (ns/op) 160.21 ms 160.66 ms 🔴 +0.28%
clients_10/ (1_changepack(bytes)) 745.00 B 745.00 B ⚪ 0%
clients_10/ (2_snapshot(bytes)) 379.00 B 379.00 B ⚪ 0%
clients_10/ (3_pushpull(ms)) 8.00 ms 7.00 ms 🟢 -12.50%
clients_10/ (4_attach(ms)) 6.00 ms 6.00 ms ⚪ 0%
clients_10/ (5_changepack_after_detach(bytes)) 805.00 B 805.00 B ⚪ 0%
clients_10/ (6_snapshot_after_detach(bytes)) 136.00 B 136.00 B ⚪ 0%
clients_10/ (7_pushpull_after_detach(ms)) 8.00 ms 8.00 ms ⚪ 0%
clients_10/ (B/op) 19.93 MB 18.28 MB 🟢 -8.26%
clients_10/ (allocs/op) 83,762 allocs 83,724 allocs 🟢 -0.05%
clients_100/ (ns/op) 1.41 s 1.43 s 🔴 +1.30%
clients_100/ (1_changepack(bytes)) 6.14 KB 6.14 KB ⚪ 0%
clients_100/ (2_snapshot(bytes)) 3.08 KB 3.08 KB ⚪ 0%
clients_100/ (3_pushpull(ms)) 11.00 ms 11.00 ms ⚪ 0%
clients_100/ (4_attach(ms)) 11.00 ms 11.00 ms ⚪ 0%
clients_100/ (5_changepack_after_detach(bytes)) 6.21 KB 6.21 KB ⚪ 0%
clients_100/ (6_snapshot_after_detach(bytes)) 137.00 B 137.00 B ⚪ 0%
clients_100/ (7_pushpull_after_detach(ms)) 9.00 ms 9.00 ms ⚪ 0%
clients_100/ (B/op) 230.31 MB 231.20 MB 🔴 +0.39%
clients_100/ (allocs/op) 1,539,768 allocs 1,539,883 allocs ⚪ 0%
clients_1000/ (ns/op) 60.97 s 60.25 s 🟢 -1.18%
clients_1000/ (1_changepack(bytes)) 60.16 KB 60.16 KB ⚪ 0%
clients_1000/ (2_snapshot(bytes)) 30.08 KB 30.08 KB ⚪ 0%
clients_1000/ (3_pushpull(ms)) 95.00 ms 94.00 ms 🟢 -1.05%
clients_1000/ (4_attach(ms)) 249.00 ms 216.00 ms 🟢 -13.25%
clients_1000/ (5_changepack_after_detach(bytes)) 60.22 KB 60.22 KB ⚪ 0%
clients_1000/ (6_snapshot_after_detach(bytes)) 139.00 B 139.00 B ⚪ 0%
clients_1000/ (7_pushpull_after_detach(ms)) 26.00 ms 23.00 ms 🟢 -11.54%
clients_1000/ (B/op) 22.07 GB 22.07 GB ⚪ 0%
clients_1000/ (allocs/op) 111,762,106 allocs 111,757,974 allocs ⚪ 0%

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (3)
pkg/throttle/throttler.go (2)

17-18: Enhance package documentation.

The package documentation is minimal. Consider adding more details about the package's purpose, usage examples, and common use cases.

Apply this diff to improve the documentation:

-// Package throttle provide event timing control components
+// Package throttle provides event timing control components for managing callback execution rates.
+// It implements throttling and debouncing mechanisms to ensure that callbacks are executed
+// at most once within a specified time window, while maintaining eventual consistency.
+//
+// Example usage:
+//
+//	th := throttle.New(time.Second)
+//	
+//	// For synchronous execution with blocking
+//	err := th.Execute(ctx, func() error {
+//	    // your callback logic here
+//	    return nil
+//	})
+//	
+//	// For asynchronous execution without blocking
+//	th.ExecuteOrSchedule(func() {
+//	    // your callback logic here
+//	})

32-35: Consider adding methods to check throttler state.

The Throttler struct could benefit from methods to check its current state, such as whether it's currently throttled or has pending callbacks.

Consider adding these methods:

// IsPending returns true if there is a pending callback.
func (t *Throttler) IsPending() bool {
    return atomic.LoadInt32(&t.pending) == 1
}

// IsThrottled returns true if the rate limiter would not allow an immediate execution.
func (t *Throttler) IsThrottled() bool {
    return !t.lim.Allow()
}
pkg/throttle/throttler_test.go (1)

32-62: Add edge case tests for window duration.

The test suite should include tests for edge cases like zero or negative window durations.

Add these test cases:

func TestNewWithInvalidWindow(t *testing.T) {
    t.Run("zero window duration", func(t *testing.T) {
        th := New(0)
        assert.NotNil(t, th)
        assert.NotNil(t, th.lim)
    })

    t.Run("negative window duration", func(t *testing.T) {
        th := New(-time.Second)
        assert.NotNil(t, th)
        assert.NotNil(t, th.lim)
    })
}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5299469 and 7386170.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (3)
  • go.mod (1 hunks)
  • pkg/throttle/throttler.go (1 hunks)
  • pkg/throttle/throttler_test.go (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: build
  • GitHub Check: bench
🔇 Additional comments (1)
go.mod (1)

3-3:

Details

✅ Verification successful

Verify Go version compatibility.

The module requires Go 1.23, which is not yet released. The latest stable version is Go 1.22.


🌐 Web query:

What is the latest stable version of Go?

💡 Result:

The latest stable version of Go is 1.24.0, released on February 11, 2025[3][8]. This release follows the standard six-month cadence for major Go updates[6][8].

Key details about current Go versions:

  • Go 1.24 (released Feb 11, 2025)
    Actively supported with security and bug fixes[3][4]
  • Go 1.23 (released Aug 13, 2024)
    Still supported with latest patch version 1.23.6 (Feb 4, 2025)[3][4]
  • Go 1.22 (released Feb 6, 2024)
    Support ended Feb 11, 2025[3]

The Go team maintains a policy where each major release receives official support until two subsequent major releases appear[3][4]. Users are encouraged to upgrade to supported versions to receive security updates and critical bug fixes automatically through Go's toolchain management system introduced in Go 1.21[2][6].

Citations:


Action: Validate the Go version requirement in go.mod

The go.mod file now specifies:

go 1.23

Based on the latest release information, Go 1.23 was released on August 13, 2024 and is still supported (with patch version 1.23.6 released in February 2025). Although the most recent stable version is now Go 1.24.0, using Go 1.23 remains valid. You may consider upgrading to 1.24 to benefit from the latest features and improvements, but there is no immediate compatibility issue with retaining Go 1.23.

Comment thread pkg/throttle/throttler.go Outdated
Comment thread pkg/throttle/throttler_test.go Outdated
- wait goroutine done in test
- use const
- use wait group

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (3)
pkg/limit/throttler.go (2)

29-44: Add input validation and consider using constants for atomic values.

The implementation looks good, but consider these improvements:

  1. Add validation for non-negative window duration
  2. Use constants for atomic values to improve readability
+const (
+    notPending int32 = 0
+    pending    int32 = 1
+)

 func New(window time.Duration) *Throttler {
+    if window <= 0 {
+        panic("window duration must be positive")
+    }
     dt := &Throttler{
         lim:     rate.NewLimiter(rate.Every(window), 1),
-        pending: 0,
+        pending: notPending,
     }
     return dt
 }

46-66: Improve error handling in Execute method.

The error handling looks good, but consider wrapping the callback error for better error context:

 func (t *Throttler) Execute(ctx context.Context, callback func() error) error {
     if t.lim.Allow() {
-        return callback()
+        if err := callback(); err != nil {
+            return fmt.Errorf("execute immediate callback: %w", err)
+        }
+        return nil
     }

     if !atomic.CompareAndSwapInt32(&t.pending, 0, 1) {
         return nil
     }

     if err := t.lim.Wait(ctx); err != nil {
         return fmt.Errorf("wait for limiter: %w", err)
     }

     atomic.StoreInt32(&t.pending, 0)
-    return callback()
+    if err := callback(); err != nil {
+        return fmt.Errorf("execute delayed callback: %w", err)
+    }
+    return nil
 }
pkg/limit/throttler_test.go (1)

31-63: Add edge cases to TestSynchronousExecute.

Consider adding these test cases:

  1. Zero duration window
  2. Negative duration window
  3. Nil callback function
 func TestSynchronousExecute(t *testing.T) {
+    t.Run("Zero duration window panics", func(t *testing.T) {
+        assert.Panics(t, func() {
+            New(0)
+        })
+    })
+
+    t.Run("Negative duration window panics", func(t *testing.T) {
+        assert.Panics(t, func() {
+            New(-time.Millisecond)
+        })
+    })
+
+    t.Run("Nil callback panics", func(t *testing.T) {
+        th := New(throttleWindow)
+        assert.Panics(t, func() {
+            th.Execute(context.Background(), nil)
+        })
+    })
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7386170 and f7b9d6d.

📒 Files selected for processing (2)
  • pkg/limit/throttler.go (1 hunks)
  • pkg/limit/throttler_test.go (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: bench
  • GitHub Check: build

Comment thread pkg/limit/throttler.go Outdated
Comment thread pkg/limit/throttler.go Outdated
Comment thread pkg/limit/throttler_test.go Outdated

@hackerwins-yorkie hackerwins-yorkie left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Go Benchmark Analysis 📊

This is a comparison result between the previous(e687d61) and the current commit(71e15d1).

Significant Changes (≥20% difference)

Benchmark suite Previous Current Change
BenchmarkRWLocker/RWLock_rate_100/ (B/op) 2.00 B 1.00 B 🟢 -50.00%

Key Observations 🔍

  • The benchmark suite BenchmarkRWLocker/RWLock_rate_100/ showed a significant decrease of -50.00% in the number of bytes processed per operation, indicating an improvement in efficiency.
  • Across different benchmark suites, there are generally minor fluctuations in performance, with some benchmarks showing slight improvements while others exhibit minimal declines. No major outliers or consistent trends are evident from the data provided.

Detailed Test Results

BenchmarkDocument
Benchmark suite Previous Current Change
constructor_test/ (ns/op) 1439.00 ns 1423.00 ns 🟢 -1.11%
constructor_test/ (B/op) 1.39 KB 1.39 KB ⚪ 0%
constructor_test/ (allocs/op) 24 allocs 24 allocs ⚪ 0%
status_test/ (ns/op) 1028.00 ns 1019.00 ns 🟢 -0.88%
status_test/ (B/op) 1.35 KB 1.35 KB ⚪ 0%
status_test/ (allocs/op) 22 allocs 22 allocs ⚪ 0%
equals_test/ (ns/op) 7864.00 ns 7737.00 ns 🟢 -1.61%
equals_test/ (B/op) 7.56 KB 7.56 KB ⚪ 0%
equals_test/ (allocs/op) 129 allocs 129 allocs ⚪ 0%
nested_update_test/ (ns/op) 17079.00 ns 16812.00 ns 🟢 -1.56%
nested_update_test/ (B/op) 12.31 KB 12.31 KB ⚪ 0%
nested_update_test/ (allocs/op) 258 allocs 258 allocs ⚪ 0%
delete_test/ (ns/op) 27313.00 ns 26808.00 ns 🟢 -1.85%
delete_test/ (B/op) 15.79 KB 15.79 KB ⚪ 0%
delete_test/ (allocs/op) 339 allocs 339 allocs ⚪ 0%
object_test/ (ns/op) 8546.00 ns 8489.00 ns 🟢 -0.67%
object_test/ (B/op) 7.03 KB 7.03 KB ⚪ 0%
object_test/ (allocs/op) 118 allocs 118 allocs ⚪ 0%
array_test/ (ns/op) 28984.00 ns 28425.00 ns 🟢 -1.93%
array_test/ (B/op) 12.14 KB 12.14 KB ⚪ 0%
array_test/ (allocs/op) 273 allocs 273 allocs ⚪ 0%
text_test/ (ns/op) 32155.00 ns 31758.00 ns 🟢 -1.23%
text_test/ (B/op) 15.19 KB 15.19 KB ⚪ 0%
text_test/ (allocs/op) 484 allocs 484 allocs ⚪ 0%
text_composition_test/ (ns/op) 31674.00 ns 31438.00 ns 🟢 -0.75%
text_composition_test/ (B/op) 18.70 KB 18.70 KB ⚪ 0%
text_composition_test/ (allocs/op) 501 allocs 501 allocs ⚪ 0%
rich_text_test/ (ns/op) 87424.00 ns 85834.00 ns 🟢 -1.82%
rich_text_test/ (B/op) 39.36 KB 39.36 KB ⚪ 0%
rich_text_test/ (allocs/op) 1,146 allocs 1,146 allocs ⚪ 0%
counter_test/ (ns/op) 18201.00 ns 18089.00 ns 🟢 -0.62%
counter_test/ (B/op) 11.81 KB 11.81 KB ⚪ 0%
counter_test/ (allocs/op) 253 allocs 253 allocs ⚪ 0%
text_edit_gc_100/ (ns/op) 1.39 ms 1.39 ms 🔴 +0.32%
text_edit_gc_100/ (B/op) 864.90 KB 864.86 KB ⚪ 0%
text_edit_gc_100/ (allocs/op) 17,281 allocs 17,282 allocs ⚪ 0%
text_edit_gc_1000/ (ns/op) 53.39 ms 52.83 ms 🟢 -1.04%
text_edit_gc_1000/ (B/op) 46.84 MB 46.84 MB ⚪ 0%
text_edit_gc_1000/ (allocs/op) 185,598 allocs 185,590 allocs ⚪ 0%
text_split_gc_100/ (ns/op) 2.12 ms 2.11 ms 🟢 -0.65%
text_split_gc_100/ (B/op) 1.58 MB 1.58 MB ⚪ 0%
text_split_gc_100/ (allocs/op) 15,950 allocs 15,951 allocs ⚪ 0%
text_split_gc_1000/ (ns/op) 128.25 ms 127.47 ms 🟢 -0.60%
text_split_gc_1000/ (B/op) 137.79 MB 137.79 MB ⚪ 0%
text_split_gc_1000/ (allocs/op) 185,000 allocs 184,998 allocs ⚪ 0%
text_delete_all_10000/ (ns/op) 18.43 ms 16.82 ms 🟢 -8.75%
text_delete_all_10000/ (B/op) 10.58 MB 10.58 MB ⚪ 0%
text_delete_all_10000/ (allocs/op) 56,134 allocs 56,134 allocs ⚪ 0%
text_delete_all_100000/ (ns/op) 312.31 ms 282.78 ms 🟢 -9.45%
text_delete_all_100000/ (B/op) 105.54 MB 105.51 MB 🟢 -0.03%
text_delete_all_100000/ (allocs/op) 566,133 allocs 566,061 allocs 🟢 -0.01%
text_100/ (ns/op) 234634.00 ns 242903.00 ns 🔴 +3.52%
text_100/ (B/op) 120.94 KB 120.91 KB 🟢 -0.03%
text_100/ (allocs/op) 5,181 allocs 5,181 allocs ⚪ 0%
text_1000/ (ns/op) 2.46 ms 2.53 ms 🔴 +2.85%
text_1000/ (B/op) 1.16 MB 1.16 MB 🔴 +0.03%
text_1000/ (allocs/op) 51,084 allocs 51,084 allocs ⚪ 0%
array_1000/ (ns/op) 1.24 ms 1.30 ms 🔴 +5.05%
array_1000/ (B/op) 1.09 MB 1.09 MB ⚪ 0%
array_1000/ (allocs/op) 11,879 allocs 11,879 allocs ⚪ 0%
array_10000/ (ns/op) 13.33 ms 13.38 ms 🔴 +0.37%
array_10000/ (B/op) 9.89 MB 9.89 MB ⚪ 0%
array_10000/ (allocs/op) 120,735 allocs 120,734 allocs ⚪ 0%
array_gc_100/ (ns/op) 131750.00 ns 137737.00 ns 🔴 +4.54%
array_gc_100/ (B/op) 99.89 KB 99.88 KB 🟢 -0.01%
array_gc_100/ (allocs/op) 1,266 allocs 1,266 allocs ⚪ 0%
array_gc_1000/ (ns/op) 1.42 ms 1.47 ms 🔴 +3.84%
array_gc_1000/ (B/op) 1.14 MB 1.14 MB ⚪ 0%
array_gc_1000/ (allocs/op) 12,926 allocs 12,926 allocs ⚪ 0%
counter_1000/ (ns/op) 202098.00 ns 210307.00 ns 🔴 +4.06%
counter_1000/ (B/op) 178.13 KB 178.13 KB ⚪ 0%
counter_1000/ (allocs/op) 5,771 allocs 5,771 allocs ⚪ 0%
counter_10000/ (ns/op) 2.17 ms 2.20 ms 🔴 +1.29%
counter_10000/ (B/op) 2.07 MB 2.07 MB ⚪ 0%
counter_10000/ (allocs/op) 59,778 allocs 59,778 allocs ⚪ 0%
object_1000/ (ns/op) 1.39 ms 1.46 ms 🔴 +5.22%
object_1000/ (B/op) 1.44 MB 1.44 MB 🔴 +0.01%
object_1000/ (allocs/op) 9,925 allocs 9,925 allocs ⚪ 0%
object_10000/ (ns/op) 14.82 ms 14.54 ms 🟢 -1.89%
object_10000/ (B/op) 12.35 MB 12.35 MB 🟢 -0.02%
object_10000/ (allocs/op) 101,232 allocs 101,224 allocs ⚪ 0%
tree_100/ (ns/op) 1.02 ms 1.07 ms 🔴 +5.14%
tree_100/ (B/op) 951.02 KB 951.03 KB ⚪ 0%
tree_100/ (allocs/op) 6,102 allocs 6,102 allocs ⚪ 0%
tree_1000/ (ns/op) 74.23 ms 79.31 ms 🔴 +6.84%
tree_1000/ (B/op) 86.58 MB 86.58 MB ⚪ 0%
tree_1000/ (allocs/op) 60,111 allocs 60,112 allocs ⚪ 0%
tree_10000/ (ns/op) 9.68 s 9.57 s 🟢 -1.13%
tree_10000/ (B/op) 8.58 GB 8.58 GB ⚪ 0%
tree_10000/ (allocs/op) 600,173 allocs 600,198 allocs ⚪ 0%
tree_delete_all_1000/ (ns/op) 78.41 ms 80.79 ms 🔴 +3.04%
tree_delete_all_1000/ (B/op) 87.57 MB 87.57 MB ⚪ 0%
tree_delete_all_1000/ (allocs/op) 75,289 allocs 75,289 allocs ⚪ 0%
tree_edit_gc_100/ (ns/op) 3.96 ms 3.99 ms 🔴 +0.67%
tree_edit_gc_100/ (B/op) 4.15 MB 4.15 MB ⚪ 0%
tree_edit_gc_100/ (allocs/op) 15,147 allocs 15,146 allocs ⚪ 0%
tree_edit_gc_1000/ (ns/op) 332.75 ms 334.66 ms 🔴 +0.58%
tree_edit_gc_1000/ (B/op) 384.04 MB 384.04 MB ⚪ 0%
tree_edit_gc_1000/ (allocs/op) 154,952 allocs 154,940 allocs ⚪ 0%
tree_split_gc_100/ (ns/op) 2.67 ms 2.74 ms 🔴 +2.54%
tree_split_gc_100/ (B/op) 2.41 MB 2.41 MB ⚪ 0%
tree_split_gc_100/ (allocs/op) 11,131 allocs 11,131 allocs ⚪ 0%
tree_split_gc_1000/ (ns/op) 197.74 ms 204.38 ms 🔴 +3.36%
tree_split_gc_1000/ (B/op) 222.50 MB 222.50 MB ⚪ 0%
tree_split_gc_1000/ (allocs/op) 122,053 allocs 122,077 allocs 🔴 +0.02%
BenchmarkRPC
Benchmark suite Previous Current Change
client_to_server/ (ns/op) 431.85 ms 417.28 ms 🟢 -3.37%
client_to_server/ (B/op) 16.13 MB 16.13 MB ⚪ 0%
client_to_server/ (allocs/op) 223,674 allocs 223,644 allocs 🟢 -0.01%
client_to_client_via_server/ (ns/op) 788.62 ms 771.45 ms 🟢 -2.18%
client_to_client_via_server/ (B/op) 37.20 MB 36.70 MB 🟢 -1.34%
client_to_client_via_server/ (allocs/op) 478,656 allocs 475,803 allocs 🟢 -0.60%
attach_large_document/ (ns/op) 1.32 s 1.29 s 🟢 -2.86%
attach_large_document/ (B/op) 1.89 GB 1.92 GB 🔴 +1.81%
attach_large_document/ (allocs/op) 12,321 allocs 12,393 allocs 🔴 +0.58%
adminCli_to_server/ (ns/op) 542.08 ms 543.37 ms 🔴 +0.24%
adminCli_to_server/ (B/op) 21.76 MB 22.51 MB 🔴 +3.48%
adminCli_to_server/ (allocs/op) 291,952 allocs 316,700 allocs 🔴 +8.48%
BenchmarkLocker
Benchmark suite Previous Current Change
(ns/op) 82.86 ns 82.10 ns 🟢 -0.92%
(B/op) 32.00 B 32.00 B ⚪ 0%
(allocs/op) 1 allocs 1 allocs ⚪ 0%
BenchmarkLockerParallel
Benchmark suite Previous Current Change
(ns/op) 45.80 ns 45.19 ns 🟢 -1.33%
(B/op) 0.00 B 0.00 B ⚪ 0%
(allocs/op) 0 allocs 0 allocs ⚪ 0%
BenchmarkLockerMoreKeys
Benchmark suite Previous Current Change
(ns/op) 180.50 ns 165.60 ns 🟢 -8.25%
(B/op) 31.00 B 31.00 B ⚪ 0%
(allocs/op) 0 allocs 0 allocs ⚪ 0%
BenchmarkRWLocker
Benchmark suite Previous Current Change
RWLock_rate_2/ (ns/op) 50.25 ns 49.09 ns 🟢 -2.31%
RWLock_rate_2/ (B/op) 0.00 B 0.00 B ⚪ 0%
RWLock_rate_2/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
RWLock_rate_10/ (ns/op) 44.88 ns 43.31 ns 🟢 -3.50%
RWLock_rate_10/ (B/op) 0.00 B 0.00 B ⚪ 0%
RWLock_rate_10/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
RWLock_rate_100/ (ns/op) 63.08 ns 58.54 ns 🟢 -7.20%
RWLock_rate_100/ (B/op) 2.00 B 1.00 B 🟢 -50.00%
RWLock_rate_100/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
RWLock_rate_1000/ (ns/op) 91.91 ns 86.82 ns 🟢 -5.54%
RWLock_rate_1000/ (B/op) 8.00 B 8.00 B ⚪ 0%
RWLock_rate_1000/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
BenchmarkChange
Benchmark suite Previous Current Change
Push_10_Changes/ (ns/op) 4.54 ms 4.43 ms 🟢 -2.43%
Push_10_Changes/ (B/op) 150.42 KB 151.00 KB 🔴 +0.39%
Push_10_Changes/ (allocs/op) 1,623 allocs 1,624 allocs 🔴 +0.06%
Push_100_Changes/ (ns/op) 16.52 ms 15.80 ms 🟢 -4.36%
Push_100_Changes/ (B/op) 770.59 KB 775.07 KB 🔴 +0.58%
Push_100_Changes/ (allocs/op) 8,509 allocs 8,510 allocs 🔴 +0.01%
Push_1000_Changes/ (ns/op) 129.20 ms 126.66 ms 🟢 -1.97%
Push_1000_Changes/ (B/op) 7.22 MB 7.23 MB 🔴 +0.11%
Push_1000_Changes/ (allocs/op) 79,325 allocs 79,322 allocs ⚪ 0%
Pull_10_Changes/ (ns/op) 3.70 ms 3.65 ms 🟢 -1.45%
Pull_10_Changes/ (B/op) 124.59 KB 125.01 KB 🔴 +0.34%
Pull_10_Changes/ (allocs/op) 1,456 allocs 1,456 allocs ⚪ 0%
Pull_100_Changes/ (ns/op) 5.32 ms 5.22 ms 🟢 -1.99%
Pull_100_Changes/ (B/op) 354.61 KB 355.30 KB 🔴 +0.19%
Pull_100_Changes/ (allocs/op) 5,182 allocs 5,182 allocs ⚪ 0%
Pull_1000_Changes/ (ns/op) 10.88 ms 10.65 ms 🟢 -2.05%
Pull_1000_Changes/ (B/op) 2.20 MB 2.20 MB ⚪ 0%
Pull_1000_Changes/ (allocs/op) 44,681 allocs 44,681 allocs ⚪ 0%
BenchmarkSnapshot
Benchmark suite Previous Current Change
Push_3KB_snapshot/ (ns/op) 19.55 ms 18.18 ms 🟢 -7.02%
Push_3KB_snapshot/ (B/op) 905.58 KB 919.83 KB 🔴 +1.57%
Push_3KB_snapshot/ (allocs/op) 8,516 allocs 8,514 allocs 🟢 -0.02%
Push_30KB_snapshot/ (ns/op) 132.18 ms 129.86 ms 🟢 -1.75%
Push_30KB_snapshot/ (B/op) 8.24 MB 8.25 MB 🔴 +0.12%
Push_30KB_snapshot/ (allocs/op) 89,008 allocs 89,057 allocs 🔴 +0.06%
Pull_3KB_snapshot/ (ns/op) 7.80 ms 7.43 ms 🟢 -4.76%
Pull_3KB_snapshot/ (B/op) 1.12 MB 1.12 MB 🔴 +0.13%
Pull_3KB_snapshot/ (allocs/op) 20,064 allocs 20,065 allocs ⚪ 0%
Pull_30KB_snapshot/ (ns/op) 19.91 ms 19.41 ms 🟢 -2.53%
Pull_30KB_snapshot/ (B/op) 9.31 MB 9.31 MB ⚪ 0%
Pull_30KB_snapshot/ (allocs/op) 193,610 allocs 193,605 allocs ⚪ 0%
BenchmarkSplayTree
Benchmark suite Previous Current Change
stress_test_100000/ (ns/op) 0.19 ns 0.19 ns 🟢 -2.53%
stress_test_100000/ (B/op) 0.00 B 0.00 B ⚪ 0%
stress_test_100000/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
stress_test_200000/ (ns/op) 0.40 ns 0.38 ns 🟢 -2.61%
stress_test_200000/ (B/op) 0.00 B 0.00 B ⚪ 0%
stress_test_200000/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
stress_test_300000/ (ns/op) 0.57 ns 0.57 ns 🔴 +1.11%
stress_test_300000/ (B/op) 0.00 B 0.00 B ⚪ 0%
stress_test_300000/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
random_access_100000/ (ns/op) 0.01 ns 0.01 ns 🟢 -1.18%
random_access_100000/ (B/op) 0.00 B 0.00 B ⚪ 0%
random_access_100000/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
random_access_200000/ (ns/op) 0.03 ns 0.03 ns 🟢 -6.79%
random_access_200000/ (B/op) 0.00 B 0.00 B ⚪ 0%
random_access_200000/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
random_access_300000/ (ns/op) 0.04 ns 0.05 ns 🔴 +5.36%
random_access_300000/ (B/op) 0.00 B 0.00 B ⚪ 0%
random_access_300000/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
editing_trace_bench/ (ns/op) 0.00 ns 0.00 ns 🔴 +2.02%
editing_trace_bench/ (B/op) 0.00 B 0.00 B ⚪ 0%
editing_trace_bench/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
BenchmarkSync
Benchmark suite Previous Current Change
memory_sync_10_test/ (ns/op) 7288.00 ns 7109.00 ns 🟢 -2.46%
memory_sync_10_test/ (B/op) 1.34 KB 1.34 KB 🔴 +0.07%
memory_sync_10_test/ (allocs/op) 35 allocs 35 allocs ⚪ 0%
memory_sync_100_test/ (ns/op) 55353.00 ns 54894.00 ns 🟢 -0.83%
memory_sync_100_test/ (B/op) 9.51 KB 9.52 KB 🔴 +0.14%
memory_sync_100_test/ (allocs/op) 268 allocs 268 allocs ⚪ 0%
memory_sync_1000_test/ (ns/op) 616285.00 ns 609643.00 ns 🟢 -1.08%
memory_sync_1000_test/ (B/op) 75.92 KB 75.88 KB 🟢 -0.05%
memory_sync_1000_test/ (allocs/op) 2,111 allocs 2,111 allocs ⚪ 0%
memory_sync_10000_test/ (ns/op) 7.47 ms 7.62 ms 🔴 +1.94%
memory_sync_10000_test/ (B/op) 761.49 KB 766.27 KB 🔴 +0.63%
memory_sync_10000_test/ (allocs/op) 20,475 allocs 20,520 allocs 🔴 +0.22%
BenchmarkTextEditing
Benchmark suite Previous Current Change
(ns/op) 5.18 s 5.13 s 🟢 -0.89%
(B/op) 3.92 GB 3.92 GB ⚪ 0%
(allocs/op) 20,619,777 allocs 20,619,808 allocs ⚪ 0%
BenchmarkTree
Benchmark suite Previous Current Change
10000_vertices_to_protobuf/ (ns/op) 4.17 ms 4.28 ms 🔴 +2.68%
10000_vertices_to_protobuf/ (B/op) 6.36 MB 6.36 MB ⚪ 0%
10000_vertices_to_protobuf/ (allocs/op) 70,025 allocs 70,025 allocs ⚪ 0%
10000_vertices_from_protobuf/ (ns/op) 217.30 ms 224.11 ms 🔴 +3.13%
10000_vertices_from_protobuf/ (B/op) 442.30 MB 442.31 MB ⚪ 0%
10000_vertices_from_protobuf/ (allocs/op) 290,038 allocs 290,049 allocs ⚪ 0%
20000_vertices_to_protobuf/ (ns/op) 8.84 ms 9.06 ms 🔴 +2.49%
20000_vertices_to_protobuf/ (B/op) 12.89 MB 12.89 MB ⚪ 0%
20000_vertices_to_protobuf/ (allocs/op) 140,028 allocs 140,028 allocs ⚪ 0%
20000_vertices_from_protobuf/ (ns/op) 884.61 ms 879.94 ms 🟢 -0.53%
20000_vertices_from_protobuf/ (B/op) 1.70 GB 1.70 GB ⚪ 0%
20000_vertices_from_protobuf/ (allocs/op) 580,043 allocs 580,090 allocs ⚪ 0%
30000_vertices_to_protobuf/ (ns/op) 14.26 ms 13.83 ms 🟢 -3.04%
30000_vertices_to_protobuf/ (B/op) 18.98 MB 18.98 MB ⚪ 0%
30000_vertices_to_protobuf/ (allocs/op) 210,029 allocs 210,029 allocs ⚪ 0%
30000_vertices_from_protobuf/ (ns/op) 2.00 s 1.99 s 🟢 -0.35%
30000_vertices_from_protobuf/ (B/op) 3.75 GB 3.75 GB ⚪ 0%
30000_vertices_from_protobuf/ (allocs/op) 870,147 allocs 870,054 allocs 🟢 -0.01%
BenchmarkVersionVector
Benchmark suite Previous Current Change
clients_10/ (ns/op) 160.21 ms 157.36 ms 🟢 -1.78%
clients_10/ (1_changepack(bytes)) 745.00 B 745.00 B ⚪ 0%
clients_10/ (2_snapshot(bytes)) 379.00 B 379.00 B ⚪ 0%
clients_10/ (3_pushpull(ms)) 8.00 ms 7.00 ms 🟢 -12.50%
clients_10/ (4_attach(ms)) 6.00 ms 6.00 ms ⚪ 0%
clients_10/ (5_changepack_after_detach(bytes)) 805.00 B 805.00 B ⚪ 0%
clients_10/ (6_snapshot_after_detach(bytes)) 136.00 B 136.00 B ⚪ 0%
clients_10/ (7_pushpull_after_detach(ms)) 8.00 ms 8.00 ms ⚪ 0%
clients_10/ (B/op) 19.93 MB 20.65 MB 🔴 +3.60%
clients_10/ (allocs/op) 83,762 allocs 83,779 allocs 🔴 +0.02%
clients_100/ (ns/op) 1.41 s 1.44 s 🔴 +1.75%
clients_100/ (1_changepack(bytes)) 6.14 KB 6.14 KB ⚪ 0%
clients_100/ (2_snapshot(bytes)) 3.08 KB 3.08 KB ⚪ 0%
clients_100/ (3_pushpull(ms)) 11.00 ms 11.00 ms ⚪ 0%
clients_100/ (4_attach(ms)) 11.00 ms 10.00 ms 🟢 -9.09%
clients_100/ (5_changepack_after_detach(bytes)) 6.21 KB 6.21 KB ⚪ 0%
clients_100/ (6_snapshot_after_detach(bytes)) 137.00 B 137.00 B ⚪ 0%
clients_100/ (7_pushpull_after_detach(ms)) 9.00 ms 9.00 ms ⚪ 0%
clients_100/ (B/op) 230.31 MB 229.51 MB 🟢 -0.35%
clients_100/ (allocs/op) 1,539,768 allocs 1,539,234 allocs 🟢 -0.03%
clients_1000/ (ns/op) 60.97 s 60.23 s 🟢 -1.21%
clients_1000/ (1_changepack(bytes)) 60.16 KB 60.16 KB ⚪ 0%
clients_1000/ (2_snapshot(bytes)) 30.08 KB 30.08 KB ⚪ 0%
clients_1000/ (3_pushpull(ms)) 95.00 ms 94.00 ms 🟢 -1.05%
clients_1000/ (4_attach(ms)) 249.00 ms 222.00 ms 🟢 -10.84%
clients_1000/ (5_changepack_after_detach(bytes)) 60.22 KB 60.22 KB ⚪ 0%
clients_1000/ (6_snapshot_after_detach(bytes)) 139.00 B 139.00 B ⚪ 0%
clients_1000/ (7_pushpull_after_detach(ms)) 26.00 ms 23.00 ms 🟢 -11.54%
clients_1000/ (B/op) 22.07 GB 22.07 GB 🔴 +0.03%
clients_1000/ (allocs/op) 111,762,106 allocs 111,758,327 allocs ⚪ 0%

@codecov

codecov Bot commented Feb 24, 2025

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 67.20430% with 61 lines in your changes missing coverage. Please review.

Project coverage is 38.46%. Comparing base (68c233b) to head (bd7c930).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
api/types/event_webhook.go 0.00% 26 Missing ⚠️
server/backend/webhook/manager.go 58.62% 8 Missing and 4 partials ⚠️
server/backend/backend.go 0.00% 10 Missing ⚠️
server/packs/packs.go 0.00% 8 Missing ⚠️
test/helper/helper.go 66.66% 2 Missing and 1 partial ⚠️
api/types/resource_ref_key.go 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1166      +/-   ##
==========================================
+ Coverage   38.27%   38.46%   +0.19%     
==========================================
  Files         171      173       +2     
  Lines       25793    25925     +132     
==========================================
+ Hits         9871     9972     +101     
- Misses      15088    15119      +31     
  Partials      834      834              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

- previous commit only changes directory name

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (1)
pkg/limit/throttler_test.go (1)

218-247: ⚠️ Potential issue

Update error handling in TestExecuteOrSchedule.

The test needs to be updated to include error handling as suggested in the previous review.

Please refer to the previous review comment for the implementation details.

🧹 Nitpick comments (2)
pkg/limit/throttler_test.go (2)

17-18: Enhance package documentation.

The current package documentation is minimal. Consider expanding it to include:

  • The purpose of the package
  • Key components and their responsibilities
  • Usage examples or common use cases
-// Package limit provide event timing control components
+// Package limit provides event timing control components for managing callback execution rates.
+// It includes throttling and debouncing mechanisms to control the frequency of operations,
+// making it useful for rate-limiting API calls, event handling, and other scenarios where
+// execution timing needs to be controlled.

143-158: Add test coverage for trailing callback errors.

While the current test covers immediate callback errors, consider adding test cases for:

  • Error propagation in trailing callbacks
  • Error handling during concurrent executions
t.Run("Trailing callback error is propagated", func(t *testing.T) {
    th := New(throttleWindow)
    var firstCallExecuted bool
    
    callback := func() error {
        if firstCallExecuted {
            return expectedErr
        }
        firstCallExecuted = true
        return nil
    }
    
    // First call succeeds
    assert.NoError(t, th.Execute(ctx, callback))
    // Second call should fail with expectedErr
    err := th.Execute(ctx, callback)
    assert.ErrorIs(t, err, expectedErr)
})
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f7b9d6d and 3782427.

📒 Files selected for processing (2)
  • pkg/limit/throttler.go (1 hunks)
  • pkg/limit/throttler_test.go (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • pkg/limit/throttler.go
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: build
  • GitHub Check: bench
🔇 Additional comments (3)
pkg/limit/throttler_test.go (3)

31-63: Well-structured test cases!

The test function effectively validates synchronous execution behavior with good coverage of single and multiple call scenarios. The use of atomic operations ensures thread safety.


65-141: Excellent concurrent testing implementation!

The test function provides comprehensive coverage of concurrent scenarios with:

  • Clear documentation of test objectives
  • Proper synchronization using WaitGroup
  • Thorough validation of throttling behavior under continuous load

160-216: Great context cancellation test coverage!

The test function effectively validates both context deadline and cancellation scenarios with proper verification of execution counts.

Comment thread pkg/limit/throttler_test.go Outdated

@hackerwins-yorkie hackerwins-yorkie left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Go Benchmark Analysis 📊

This is a comparison result between the previous(e687d61) and the current commit(b298ecc).

Significant Changes (≥20% difference)

Benchmark suite Previous Current Change
BenchmarkRWLocker/RWLock_rate_100/ (B/op) 2.00 B 1.00 B 🟢 -50.00%

Key Observations 🔍

  1. In the BenchmarkRWLocker suite, the RWLock_rate_100/ benchmark showed a significant improvement with a decrease of 50.00% in bytes per operation (B/op) from 2.00 B to 1.00 B.

  2. Across various benchmarks, there were several cases of slight improvements (🟢) in performance:

    • BenchmarkLockerParallel suite showed a decrease of 1.42% in ns/op.
    • BenchmarkSync suite exhibited reductions ranging from 0.55% to 4.68% in ns/op.
    • BenchmarkSnapshot suite showed improvements in ns/op ranging from 1.68% to 6.09%.
  3. Some benchmarks experienced minor increases in performance (🔴):

    • Under BenchmarkRPC, attach_large_document/ showed an increase of 0.60% in B/op.
    • In the BenchmarkChange suite, Push_100_Changes/ and Push_1000_Changes/ exhibited increases in ns/op by 1.02% and 1.78% respectively.
    • BenchmarkTree suite showed increases from 2.85% to 7.06% in ns/op for different benchmarks.

Overall, the data reflects a mixture of improvements and minor deteriorations, with the majority of benchmarks showing positive trends in performance.

Detailed Test Results

BenchmarkDocument
Benchmark suite Previous Current Change
constructor_test/ (ns/op) 1439.00 ns 1480.00 ns 🔴 +2.85%
constructor_test/ (B/op) 1.39 KB 1.39 KB ⚪ 0%
constructor_test/ (allocs/op) 24 allocs 24 allocs ⚪ 0%
status_test/ (ns/op) 1028.00 ns 1019.00 ns 🟢 -0.88%
status_test/ (B/op) 1.35 KB 1.35 KB ⚪ 0%
status_test/ (allocs/op) 22 allocs 22 allocs ⚪ 0%
equals_test/ (ns/op) 7864.00 ns 8464.00 ns 🔴 +7.63%
equals_test/ (B/op) 7.56 KB 7.56 KB ⚪ 0%
equals_test/ (allocs/op) 129 allocs 129 allocs ⚪ 0%
nested_update_test/ (ns/op) 17079.00 ns 17791.00 ns 🔴 +4.17%
nested_update_test/ (B/op) 12.31 KB 12.31 KB ⚪ 0%
nested_update_test/ (allocs/op) 258 allocs 258 allocs ⚪ 0%
delete_test/ (ns/op) 27313.00 ns 23107.00 ns 🟢 -15.40%
delete_test/ (B/op) 15.79 KB 15.79 KB ⚪ 0%
delete_test/ (allocs/op) 339 allocs 339 allocs ⚪ 0%
object_test/ (ns/op) 8546.00 ns 8542.00 ns 🟢 -0.05%
object_test/ (B/op) 7.03 KB 7.03 KB 🔴 +0.01%
object_test/ (allocs/op) 118 allocs 118 allocs ⚪ 0%
array_test/ (ns/op) 28984.00 ns 28313.00 ns 🟢 -2.32%
array_test/ (B/op) 12.14 KB 12.14 KB ⚪ 0%
array_test/ (allocs/op) 273 allocs 273 allocs ⚪ 0%
text_test/ (ns/op) 32155.00 ns 32211.00 ns 🔴 +0.17%
text_test/ (B/op) 15.19 KB 15.19 KB ⚪ 0%
text_test/ (allocs/op) 484 allocs 484 allocs ⚪ 0%
text_composition_test/ (ns/op) 31674.00 ns 31450.00 ns 🟢 -0.71%
text_composition_test/ (B/op) 18.70 KB 18.70 KB ⚪ 0%
text_composition_test/ (allocs/op) 501 allocs 501 allocs ⚪ 0%
rich_text_test/ (ns/op) 87424.00 ns 85471.00 ns 🟢 -2.23%
rich_text_test/ (B/op) 39.36 KB 39.36 KB ⚪ 0%
rich_text_test/ (allocs/op) 1,146 allocs 1,146 allocs ⚪ 0%
counter_test/ (ns/op) 18201.00 ns 17965.00 ns 🟢 -1.30%
counter_test/ (B/op) 11.81 KB 11.81 KB ⚪ 0%
counter_test/ (allocs/op) 253 allocs 253 allocs ⚪ 0%
text_edit_gc_100/ (ns/op) 1.39 ms 1.39 ms 🟢 -0.16%
text_edit_gc_100/ (B/op) 864.90 KB 864.92 KB ⚪ 0%
text_edit_gc_100/ (allocs/op) 17,281 allocs 17,282 allocs ⚪ 0%
text_edit_gc_1000/ (ns/op) 53.39 ms 52.16 ms 🟢 -2.30%
text_edit_gc_1000/ (B/op) 46.84 MB 46.84 MB ⚪ 0%
text_edit_gc_1000/ (allocs/op) 185,598 allocs 185,590 allocs ⚪ 0%
text_split_gc_100/ (ns/op) 2.12 ms 2.10 ms 🟢 -1.09%
text_split_gc_100/ (B/op) 1.58 MB 1.58 MB ⚪ 0%
text_split_gc_100/ (allocs/op) 15,950 allocs 15,951 allocs ⚪ 0%
text_split_gc_1000/ (ns/op) 128.25 ms 126.29 ms 🟢 -1.53%
text_split_gc_1000/ (B/op) 137.79 MB 137.79 MB ⚪ 0%
text_split_gc_1000/ (allocs/op) 185,000 allocs 184,990 allocs ⚪ 0%
text_delete_all_10000/ (ns/op) 18.43 ms 16.46 ms 🟢 -10.70%
text_delete_all_10000/ (B/op) 10.58 MB 10.58 MB ⚪ 0%
text_delete_all_10000/ (allocs/op) 56,134 allocs 56,132 allocs ⚪ 0%
text_delete_all_100000/ (ns/op) 312.31 ms 287.17 ms 🟢 -8.05%
text_delete_all_100000/ (B/op) 105.54 MB 105.50 MB 🟢 -0.04%
text_delete_all_100000/ (allocs/op) 566,133 allocs 565,990 allocs 🟢 -0.03%
text_100/ (ns/op) 234634.00 ns 230544.00 ns 🟢 -1.74%
text_100/ (B/op) 120.94 KB 120.94 KB ⚪ 0%
text_100/ (allocs/op) 5,181 allocs 5,181 allocs ⚪ 0%
text_1000/ (ns/op) 2.46 ms 2.46 ms 🟢 -0.08%
text_1000/ (B/op) 1.16 MB 1.16 MB ⚪ 0%
text_1000/ (allocs/op) 51,084 allocs 51,084 allocs ⚪ 0%
array_1000/ (ns/op) 1.24 ms 1.25 ms 🔴 +0.70%
array_1000/ (B/op) 1.09 MB 1.09 MB ⚪ 0%
array_1000/ (allocs/op) 11,879 allocs 11,879 allocs ⚪ 0%
array_10000/ (ns/op) 13.33 ms 13.40 ms 🔴 +0.50%
array_10000/ (B/op) 9.89 MB 9.89 MB ⚪ 0%
array_10000/ (allocs/op) 120,735 allocs 120,732 allocs ⚪ 0%
array_gc_100/ (ns/op) 131750.00 ns 134574.00 ns 🔴 +2.14%
array_gc_100/ (B/op) 99.89 KB 99.87 KB 🟢 -0.02%
array_gc_100/ (allocs/op) 1,266 allocs 1,266 allocs ⚪ 0%
array_gc_1000/ (ns/op) 1.42 ms 1.45 ms 🔴 +2.07%
array_gc_1000/ (B/op) 1.14 MB 1.14 MB ⚪ 0%
array_gc_1000/ (allocs/op) 12,926 allocs 12,926 allocs ⚪ 0%
counter_1000/ (ns/op) 202098.00 ns 207534.00 ns 🔴 +2.69%
counter_1000/ (B/op) 178.13 KB 178.13 KB ⚪ 0%
counter_1000/ (allocs/op) 5,771 allocs 5,771 allocs ⚪ 0%
counter_10000/ (ns/op) 2.17 ms 2.16 ms 🟢 -0.49%
counter_10000/ (B/op) 2.07 MB 2.07 MB ⚪ 0%
counter_10000/ (allocs/op) 59,778 allocs 59,778 allocs ⚪ 0%
object_1000/ (ns/op) 1.39 ms 1.42 ms 🔴 +2.10%
object_1000/ (B/op) 1.44 MB 1.44 MB 🔴 +0.01%
object_1000/ (allocs/op) 9,925 allocs 9,925 allocs ⚪ 0%
object_10000/ (ns/op) 14.82 ms 14.79 ms 🟢 -0.20%
object_10000/ (B/op) 12.35 MB 12.35 MB ⚪ 0%
object_10000/ (allocs/op) 101,232 allocs 101,231 allocs ⚪ 0%
tree_100/ (ns/op) 1.02 ms 1.03 ms 🔴 +1.26%
tree_100/ (B/op) 951.02 KB 951.03 KB ⚪ 0%
tree_100/ (allocs/op) 6,102 allocs 6,102 allocs ⚪ 0%
tree_1000/ (ns/op) 74.23 ms 74.49 ms 🔴 +0.35%
tree_1000/ (B/op) 86.58 MB 86.58 MB ⚪ 0%
tree_1000/ (allocs/op) 60,111 allocs 60,112 allocs ⚪ 0%
tree_10000/ (ns/op) 9.68 s 9.50 s 🟢 -1.89%
tree_10000/ (B/op) 8.58 GB 8.58 GB ⚪ 0%
tree_10000/ (allocs/op) 600,173 allocs 600,181 allocs ⚪ 0%
tree_delete_all_1000/ (ns/op) 78.41 ms 76.14 ms 🟢 -2.89%
tree_delete_all_1000/ (B/op) 87.57 MB 87.57 MB ⚪ 0%
tree_delete_all_1000/ (allocs/op) 75,289 allocs 75,289 allocs ⚪ 0%
tree_edit_gc_100/ (ns/op) 3.96 ms 3.91 ms 🟢 -1.18%
tree_edit_gc_100/ (B/op) 4.15 MB 4.15 MB ⚪ 0%
tree_edit_gc_100/ (allocs/op) 15,147 allocs 15,146 allocs ⚪ 0%
tree_edit_gc_1000/ (ns/op) 332.75 ms 313.84 ms 🟢 -5.68%
tree_edit_gc_1000/ (B/op) 384.04 MB 384.04 MB ⚪ 0%
tree_edit_gc_1000/ (allocs/op) 154,952 allocs 154,941 allocs ⚪ 0%
tree_split_gc_100/ (ns/op) 2.67 ms 2.61 ms 🟢 -2.16%
tree_split_gc_100/ (B/op) 2.41 MB 2.41 MB ⚪ 0%
tree_split_gc_100/ (allocs/op) 11,131 allocs 11,131 allocs ⚪ 0%
tree_split_gc_1000/ (ns/op) 197.74 ms 190.84 ms 🟢 -3.49%
tree_split_gc_1000/ (B/op) 222.50 MB 222.50 MB ⚪ 0%
tree_split_gc_1000/ (allocs/op) 122,053 allocs 122,070 allocs 🔴 +0.01%
BenchmarkRPC
Benchmark suite Previous Current Change
client_to_server/ (ns/op) 431.85 ms 415.81 ms 🟢 -3.71%
client_to_server/ (B/op) 16.13 MB 16.13 MB 🔴 +0.01%
client_to_server/ (allocs/op) 223,674 allocs 223,566 allocs 🟢 -0.05%
client_to_client_via_server/ (ns/op) 788.62 ms 770.96 ms 🟢 -2.24%
client_to_client_via_server/ (B/op) 37.20 MB 34.25 MB 🟢 -7.93%
client_to_client_via_server/ (allocs/op) 478,656 allocs 476,728 allocs 🟢 -0.40%
attach_large_document/ (ns/op) 1.32 s 1.29 s 🟢 -2.69%
attach_large_document/ (B/op) 1.89 GB 1.90 GB 🔴 +0.60%
attach_large_document/ (allocs/op) 12,321 allocs 12,510 allocs 🔴 +1.53%
adminCli_to_server/ (ns/op) 542.08 ms 537.25 ms 🟢 -0.89%
adminCli_to_server/ (B/op) 21.76 MB 21.47 MB 🟢 -1.31%
adminCli_to_server/ (allocs/op) 291,952 allocs 316,700 allocs 🔴 +8.48%
BenchmarkLocker
Benchmark suite Previous Current Change
(ns/op) 82.86 ns 82.29 ns 🟢 -0.69%
(B/op) 32.00 B 32.00 B ⚪ 0%
(allocs/op) 1 allocs 1 allocs ⚪ 0%
BenchmarkLockerParallel
Benchmark suite Previous Current Change
(ns/op) 45.80 ns 45.15 ns 🟢 -1.42%
(B/op) 0.00 B 0.00 B ⚪ 0%
(allocs/op) 0 allocs 0 allocs ⚪ 0%
BenchmarkLockerMoreKeys
Benchmark suite Previous Current Change
(ns/op) 180.50 ns 171.20 ns 🟢 -5.15%
(B/op) 31.00 B 31.00 B ⚪ 0%
(allocs/op) 0 allocs 0 allocs ⚪ 0%
BenchmarkRWLocker
Benchmark suite Previous Current Change
RWLock_rate_2/ (ns/op) 50.25 ns 49.20 ns 🟢 -2.09%
RWLock_rate_2/ (B/op) 0.00 B 0.00 B ⚪ 0%
RWLock_rate_2/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
RWLock_rate_10/ (ns/op) 44.88 ns 43.78 ns 🟢 -2.45%
RWLock_rate_10/ (B/op) 0.00 B 0.00 B ⚪ 0%
RWLock_rate_10/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
RWLock_rate_100/ (ns/op) 63.08 ns 57.85 ns 🟢 -8.29%
RWLock_rate_100/ (B/op) 2.00 B 1.00 B 🟢 -50.00%
RWLock_rate_100/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
RWLock_rate_1000/ (ns/op) 91.91 ns 86.53 ns 🟢 -5.85%
RWLock_rate_1000/ (B/op) 8.00 B 8.00 B ⚪ 0%
RWLock_rate_1000/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
BenchmarkChange
Benchmark suite Previous Current Change
Push_10_Changes/ (ns/op) 4.54 ms 4.48 ms 🟢 -1.20%
Push_10_Changes/ (B/op) 150.42 KB 150.32 KB 🟢 -0.06%
Push_10_Changes/ (allocs/op) 1,623 allocs 1,622 allocs 🟢 -0.06%
Push_100_Changes/ (ns/op) 16.52 ms 16.68 ms 🔴 +1.02%
Push_100_Changes/ (B/op) 770.59 KB 771.00 KB 🔴 +0.05%
Push_100_Changes/ (allocs/op) 8,509 allocs 8,508 allocs 🟢 -0.01%
Push_1000_Changes/ (ns/op) 129.20 ms 131.50 ms 🔴 +1.78%
Push_1000_Changes/ (B/op) 7.22 MB 7.16 MB 🟢 -0.85%
Push_1000_Changes/ (allocs/op) 79,325 allocs 79,324 allocs ⚪ 0%
Pull_10_Changes/ (ns/op) 3.70 ms 3.65 ms 🟢 -1.39%
Pull_10_Changes/ (B/op) 124.59 KB 125.05 KB 🔴 +0.37%
Pull_10_Changes/ (allocs/op) 1,456 allocs 1,456 allocs ⚪ 0%
Pull_100_Changes/ (ns/op) 5.32 ms 5.24 ms 🟢 -1.57%
Pull_100_Changes/ (B/op) 354.61 KB 355.33 KB 🔴 +0.20%
Pull_100_Changes/ (allocs/op) 5,182 allocs 5,183 allocs 🔴 +0.02%
Pull_1000_Changes/ (ns/op) 10.88 ms 10.62 ms 🟢 -2.33%
Pull_1000_Changes/ (B/op) 2.20 MB 2.20 MB ⚪ 0%
Pull_1000_Changes/ (allocs/op) 44,681 allocs 44,683 allocs ⚪ 0%
BenchmarkSnapshot
Benchmark suite Previous Current Change
Push_3KB_snapshot/ (ns/op) 19.55 ms 18.71 ms 🟢 -4.31%
Push_3KB_snapshot/ (B/op) 905.58 KB 895.97 KB 🟢 -1.06%
Push_3KB_snapshot/ (allocs/op) 8,516 allocs 8,513 allocs 🟢 -0.04%
Push_30KB_snapshot/ (ns/op) 132.18 ms 135.94 ms 🔴 +2.85%
Push_30KB_snapshot/ (B/op) 8.24 MB 8.39 MB 🔴 +1.78%
Push_30KB_snapshot/ (allocs/op) 89,008 allocs 90,491 allocs 🔴 +1.67%
Pull_3KB_snapshot/ (ns/op) 7.80 ms 7.33 ms 🟢 -6.09%
Pull_3KB_snapshot/ (B/op) 1.12 MB 1.12 MB 🔴 +0.06%
Pull_3KB_snapshot/ (allocs/op) 20,064 allocs 20,065 allocs ⚪ 0%
Pull_30KB_snapshot/ (ns/op) 19.91 ms 19.10 ms 🟢 -4.07%
Pull_30KB_snapshot/ (B/op) 9.31 MB 9.31 MB 🔴 +0.02%
Pull_30KB_snapshot/ (allocs/op) 193,610 allocs 193,607 allocs ⚪ 0%
BenchmarkSplayTree
Benchmark suite Previous Current Change
stress_test_100000/ (ns/op) 0.19 ns 0.19 ns 🟢 -3.41%
stress_test_100000/ (B/op) 0.00 B 0.00 B ⚪ 0%
stress_test_100000/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
stress_test_200000/ (ns/op) 0.40 ns 0.40 ns 🔴 +0.56%
stress_test_200000/ (B/op) 0.00 B 0.00 B ⚪ 0%
stress_test_200000/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
stress_test_300000/ (ns/op) 0.57 ns 0.59 ns 🔴 +3.17%
stress_test_300000/ (B/op) 0.00 B 0.00 B ⚪ 0%
stress_test_300000/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
random_access_100000/ (ns/op) 0.01 ns 0.01 ns 🟢 -2.05%
random_access_100000/ (B/op) 0.00 B 0.00 B ⚪ 0%
random_access_100000/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
random_access_200000/ (ns/op) 0.03 ns 0.03 ns 🔴 +4.53%
random_access_200000/ (B/op) 0.00 B 0.00 B ⚪ 0%
random_access_200000/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
random_access_300000/ (ns/op) 0.04 ns 0.05 ns 🔴 +2.17%
random_access_300000/ (B/op) 0.00 B 0.00 B ⚪ 0%
random_access_300000/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
editing_trace_bench/ (ns/op) 0.00 ns 0.00 ns 🟢 -3.40%
editing_trace_bench/ (B/op) 0.00 B 0.00 B ⚪ 0%
editing_trace_bench/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
BenchmarkSync
Benchmark suite Previous Current Change
memory_sync_10_test/ (ns/op) 7288.00 ns 7248.00 ns 🟢 -0.55%
memory_sync_10_test/ (B/op) 1.34 KB 1.34 KB ⚪ 0%
memory_sync_10_test/ (allocs/op) 35 allocs 35 allocs ⚪ 0%
memory_sync_100_test/ (ns/op) 55353.00 ns 54288.00 ns 🟢 -1.92%
memory_sync_100_test/ (B/op) 9.51 KB 9.52 KB 🔴 +0.18%
memory_sync_100_test/ (allocs/op) 268 allocs 268 allocs ⚪ 0%
memory_sync_1000_test/ (ns/op) 616285.00 ns 621608.00 ns 🔴 +0.86%
memory_sync_1000_test/ (B/op) 75.92 KB 75.36 KB 🟢 -0.74%
memory_sync_1000_test/ (allocs/op) 2,111 allocs 2,095 allocs 🟢 -0.76%
memory_sync_10000_test/ (ns/op) 7.47 ms 7.82 ms 🔴 +4.68%
memory_sync_10000_test/ (B/op) 761.49 KB 756.11 KB 🟢 -0.71%
memory_sync_10000_test/ (allocs/op) 20,475 allocs 20,459 allocs 🟢 -0.08%
BenchmarkTextEditing
Benchmark suite Previous Current Change
(ns/op) 5.18 s 5.28 s 🔴 +2.00%
(B/op) 3.92 GB 3.92 GB ⚪ 0%
(allocs/op) 20,619,777 allocs 20,619,653 allocs ⚪ 0%
BenchmarkTree
Benchmark suite Previous Current Change
10000_vertices_to_protobuf/ (ns/op) 4.17 ms 4.31 ms 🔴 +3.35%
10000_vertices_to_protobuf/ (B/op) 6.36 MB 6.36 MB ⚪ 0%
10000_vertices_to_protobuf/ (allocs/op) 70,025 allocs 70,025 allocs ⚪ 0%
10000_vertices_from_protobuf/ (ns/op) 217.30 ms 224.15 ms 🔴 +3.15%
10000_vertices_from_protobuf/ (B/op) 442.30 MB 442.30 MB ⚪ 0%
10000_vertices_from_protobuf/ (allocs/op) 290,038 allocs 290,039 allocs ⚪ 0%
20000_vertices_to_protobuf/ (ns/op) 8.84 ms 9.46 ms 🔴 +7.06%
20000_vertices_to_protobuf/ (B/op) 12.89 MB 12.89 MB ⚪ 0%
20000_vertices_to_protobuf/ (allocs/op) 140,028 allocs 140,028 allocs ⚪ 0%
20000_vertices_from_protobuf/ (ns/op) 884.61 ms 878.60 ms 🟢 -0.68%
20000_vertices_from_protobuf/ (B/op) 1.70 GB 1.70 GB ⚪ 0%
20000_vertices_from_protobuf/ (allocs/op) 580,043 allocs 580,044 allocs ⚪ 0%
30000_vertices_to_protobuf/ (ns/op) 14.26 ms 14.02 ms 🟢 -1.68%
30000_vertices_to_protobuf/ (B/op) 18.98 MB 18.98 MB ⚪ 0%
30000_vertices_to_protobuf/ (allocs/op) 210,029 allocs 210,029 allocs ⚪ 0%
30000_vertices_from_protobuf/ (ns/op) 2.00 s 2.02 s 🔴 +1.07%
30000_vertices_from_protobuf/ (B/op) 3.75 GB 3.75 GB ⚪ 0%
30000_vertices_from_protobuf/ (allocs/op) 870,147 allocs 870,141 allocs ⚪ 0%
BenchmarkVersionVector
Benchmark suite Previous Current Change
clients_10/ (ns/op) 160.21 ms 157.63 ms 🟢 -1.61%
clients_10/ (1_changepack(bytes)) 745.00 B 745.00 B ⚪ 0%
clients_10/ (2_snapshot(bytes)) 379.00 B 379.00 B ⚪ 0%
clients_10/ (3_pushpull(ms)) 8.00 ms 8.00 ms ⚪ 0%
clients_10/ (4_attach(ms)) 6.00 ms 6.00 ms ⚪ 0%
clients_10/ (5_changepack_after_detach(bytes)) 805.00 B 805.00 B ⚪ 0%
clients_10/ (6_snapshot_after_detach(bytes)) 136.00 B 136.00 B ⚪ 0%
clients_10/ (7_pushpull_after_detach(ms)) 8.00 ms 8.00 ms ⚪ 0%
clients_10/ (B/op) 19.93 MB 19.62 MB 🟢 -1.57%
clients_10/ (allocs/op) 83,762 allocs 83,765 allocs ⚪ 0%
clients_100/ (ns/op) 1.41 s 1.40 s 🟢 -0.55%
clients_100/ (1_changepack(bytes)) 6.14 KB 6.14 KB ⚪ 0%
clients_100/ (2_snapshot(bytes)) 3.08 KB 3.08 KB ⚪ 0%
clients_100/ (3_pushpull(ms)) 11.00 ms 10.00 ms 🟢 -9.09%
clients_100/ (4_attach(ms)) 11.00 ms 11.00 ms ⚪ 0%
clients_100/ (5_changepack_after_detach(bytes)) 6.21 KB 6.21 KB ⚪ 0%
clients_100/ (6_snapshot_after_detach(bytes)) 137.00 B 137.00 B ⚪ 0%
clients_100/ (7_pushpull_after_detach(ms)) 9.00 ms 9.00 ms ⚪ 0%
clients_100/ (B/op) 230.31 MB 230.31 MB ⚪ 0%
clients_100/ (allocs/op) 1,539,768 allocs 1,539,776 allocs ⚪ 0%
clients_1000/ (ns/op) 60.97 s 60.53 s 🟢 -0.72%
clients_1000/ (1_changepack(bytes)) 60.16 KB 60.16 KB ⚪ 0%
clients_1000/ (2_snapshot(bytes)) 30.08 KB 30.08 KB ⚪ 0%
clients_1000/ (3_pushpull(ms)) 95.00 ms 94.00 ms 🟢 -1.05%
clients_1000/ (4_attach(ms)) 249.00 ms 239.00 ms 🟢 -4.02%
clients_1000/ (5_changepack_after_detach(bytes)) 60.22 KB 60.22 KB ⚪ 0%
clients_1000/ (6_snapshot_after_detach(bytes)) 139.00 B 139.00 B ⚪ 0%
clients_1000/ (7_pushpull_after_detach(ms)) 26.00 ms 24.00 ms 🟢 -7.69%
clients_1000/ (B/op) 22.07 GB 22.06 GB 🟢 -0.03%
clients_1000/ (allocs/op) 111,762,106 allocs 111,758,279 allocs ⚪ 0%

@window9u window9u marked this pull request as draft February 25, 2025 04:53

@hackerwins-yorkie hackerwins-yorkie left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Go Benchmark Analysis 📊

This is a comparison result between the previous(e687d61) and the current commit(e0b2922).

Significant Changes (≥20% difference)

Benchmark suite Previous Current Change
BenchmarkVersionVector/clients_1000/ (B/op) 22.07 GB 6.43 GB 🟢 -70.86%
BenchmarkVersionVector/clients_1000/ (4_attach(ms)) 249.00 ms 100.00 ms 🟢 -59.84%
BenchmarkRPC/client_to_client_via_server/ (allocs/op) 478,656 allocs 297,639 allocs 🟢 -37.82%
BenchmarkRPC/client_to_client_via_server/ (B/op) 37.20 MB 24.03 MB 🟢 -35.39%
BenchmarkRPC/client_to_client_via_server/ (ns/op) 788.62 ms 560.24 ms 🟢 -28.96%
BenchmarkVersionVector/clients_1000/ (ns/op) 60.97 s 45.07 s 🟢 -26.08%
BenchmarkVersionVector/clients_10/ (7_pushpull_after_detach(ms)) 8.00 ms 10.00 ms 🔴 +25.00%

Key Observations 🔍

  • The most significant change observed is in the BenchmarkVersionVector/clients_1000/ suite, showing a remarkable decrease across various metrics:

    • Bytes operated decreased from 22.07 GB to 6.43 GB, a reduction of 70.86%.
    • Attach time went down from 249.00 ms to 100.00 ms, marking a 59.84% decrease.
    • The number of allocations per operation dropped by 16.47%.
  • The BenchmarkRPC/client_to_client_via_server/ suite also exhibited notable improvements:

    • Allocations per operation decreased by 37.82%.
    • Bytes operated dropped from 37.20 MB to 24.03 MB, marking a 35.39% reduction.
    • Nanoseconds per operation decreased by 28.96%.
  • Overall, several benchmarks showed varying degrees of improvement (🟢) or degradation (🔴) in performance metrics. Notably, some tests saw marginal changes or remained relatively constant (⚪).

  • Specific attention should be paid to the BenchmarkTree suite, where noticeable increases in time for converting vertices to protobuf were observed, ranging from 2.87% to 6.77%.

  • It is important to highlight the BenchmarkSync suite, where memory synchronization tests displayed decreases in time, with noteworthy reductions in operations involving 1000 and 10000 units.

  • The data from different suites showcases a mix of positive and negative trends, emphasizing the importance of detailed analysis to understand performance changes accurately.

Clock Analysis

Lamport (v0.5.2)

Metric 10 clients 100 clients 1000 clients
Total Operation Time 84.96 ms 793.94 ms 34.79 s
Memory Allocations 35.11 MB 219.92 MB 4.91 GB
Number of Allocations (allocs/op) 69,271 1,246,728 81,485,288
ChangePack Size 138.0 B 137.0 B 141.0 B
Snapshot Size 379.0 B 3.08 KB 30.08 KB
Push-Pull Time 2.0 ms 1.5 ms 4.0 ms
Attach Time 4.5 ms 11.0 ms 31.0 ms
ChangePack After Detach 138.0 B 140.0 B 141.0 B
Snapshot After Detach 136.0 B 137.0 B 139.0 B
Push-Pull After Detach 2.5 ms 5.0 ms 9.5 ms

VV (current)

Metric 10 clients 100 clients 1000 clients
Total Operation Time 158.60 ms 1.41 s 45.07 s
Memory Allocations 20.03 MB 223.58 MB 6.43 GB
Number of Allocations (allocs/op) 83,230 1,481,585 93,354,307
ChangePack Size 745.00 B 6.14 KB 60.16 KB
Snapshot Size 379.00 B 3.08 KB 30.08 KB
Push-Pull Time 7.00 ms 1.5 ms 91.00 ms
Attach Time 6.00 ms 9.0 ms 100.00 ms
ChangePack After Detach 805.00 B 6.21 KB 60.22 KB
Snapshot After Detach 136.00 B 137.00 B 139.00 B
Push-Pull After Detach 10.00 ms 9.00 ms 21.00 ms

Summary

  • Total operation time is generally faster with Version Vector for all client counts.
  • Memory allocations are higher for Version Vector compared to Lamport for all client counts.
  • Lamport clock has a significantly higher number of allocations per operation compared to Version Vector.
  • ChangePack and Snapshot sizes are relatively similar between the two clock types.
  • Push-Pull and Attach times vary between the clocks, with Version Vector performing better for some metrics.
  • Version Vector shows improved performance in terms of changepack after detach, except for 100 clients.
  • Version Vector has higher push-pull time after detach compared to Lamport.

Detailed Test Results

BenchmarkDocument
Benchmark suite Previous Current Change
constructor_test/ (ns/op) 1439.00 ns 1493.00 ns 🔴 +3.75%
constructor_test/ (B/op) 1.39 KB 1.43 KB 🔴 +3.47%
constructor_test/ (allocs/op) 24 allocs 25 allocs 🔴 +4.17%
status_test/ (ns/op) 1028.00 ns 1065.00 ns 🔴 +3.60%
status_test/ (B/op) 1.35 KB 1.40 KB 🔴 +3.55%
status_test/ (allocs/op) 22 allocs 23 allocs 🔴 +4.55%
equals_test/ (ns/op) 7864.00 ns 7914.00 ns 🔴 +0.64%
equals_test/ (B/op) 7.56 KB 7.71 KB 🔴 +1.90%
equals_test/ (allocs/op) 129 allocs 132 allocs 🔴 +2.33%
nested_update_test/ (ns/op) 17079.00 ns 16901.00 ns 🟢 -1.04%
nested_update_test/ (B/op) 12.31 KB 12.36 KB 🔴 +0.39%
nested_update_test/ (allocs/op) 258 allocs 259 allocs 🔴 +0.39%
delete_test/ (ns/op) 27313.00 ns 27058.00 ns 🟢 -0.93%
delete_test/ (B/op) 15.79 KB 15.84 KB 🔴 +0.30%
delete_test/ (allocs/op) 339 allocs 340 allocs 🔴 +0.29%
object_test/ (ns/op) 8546.00 ns 8569.00 ns 🔴 +0.27%
object_test/ (B/op) 7.03 KB 7.08 KB 🔴 +0.68%
object_test/ (allocs/op) 118 allocs 119 allocs 🔴 +0.85%
array_test/ (ns/op) 28984.00 ns 28242.00 ns 🟢 -2.56%
array_test/ (B/op) 12.14 KB 12.19 KB 🔴 +0.40%
array_test/ (allocs/op) 273 allocs 274 allocs 🔴 +0.37%
text_test/ (ns/op) 32155.00 ns 32360.00 ns 🔴 +0.64%
text_test/ (B/op) 15.19 KB 15.24 KB 🔴 +0.32%
text_test/ (allocs/op) 484 allocs 485 allocs 🔴 +0.21%
text_composition_test/ (ns/op) 31674.00 ns 31684.00 ns 🔴 +0.03%
text_composition_test/ (B/op) 18.70 KB 18.75 KB 🔴 +0.26%
text_composition_test/ (allocs/op) 501 allocs 502 allocs 🔴 +0.20%
rich_text_test/ (ns/op) 87424.00 ns 85742.00 ns 🟢 -1.92%
rich_text_test/ (B/op) 39.36 KB 39.41 KB 🔴 +0.12%
rich_text_test/ (allocs/op) 1,146 allocs 1,147 allocs 🔴 +0.09%
counter_test/ (ns/op) 18201.00 ns 18429.00 ns 🔴 +1.25%
counter_test/ (B/op) 11.81 KB 11.86 KB 🔴 +0.41%
counter_test/ (allocs/op) 253 allocs 254 allocs 🔴 +0.40%
text_edit_gc_100/ (ns/op) 1.39 ms 1.39 ms 🟢 -0.14%
text_edit_gc_100/ (B/op) 864.90 KB 864.94 KB ⚪ 0%
text_edit_gc_100/ (allocs/op) 17,281 allocs 17,282 allocs ⚪ 0%
text_edit_gc_1000/ (ns/op) 53.39 ms 53.16 ms 🟢 -0.43%
text_edit_gc_1000/ (B/op) 46.84 MB 46.84 MB ⚪ 0%
text_edit_gc_1000/ (allocs/op) 185,598 allocs 185,595 allocs ⚪ 0%
text_split_gc_100/ (ns/op) 2.12 ms 2.11 ms 🟢 -0.49%
text_split_gc_100/ (B/op) 1.58 MB 1.58 MB ⚪ 0%
text_split_gc_100/ (allocs/op) 15,950 allocs 15,952 allocs 🔴 +0.01%
text_split_gc_1000/ (ns/op) 128.25 ms 128.42 ms 🔴 +0.14%
text_split_gc_1000/ (B/op) 137.79 MB 137.79 MB ⚪ 0%
text_split_gc_1000/ (allocs/op) 185,000 allocs 185,002 allocs ⚪ 0%
text_delete_all_10000/ (ns/op) 18.43 ms 16.31 ms 🟢 -11.54%
text_delete_all_10000/ (B/op) 10.58 MB 10.58 MB ⚪ 0%
text_delete_all_10000/ (allocs/op) 56,134 allocs 56,135 allocs ⚪ 0%
text_delete_all_100000/ (ns/op) 312.31 ms 295.13 ms 🟢 -5.50%
text_delete_all_100000/ (B/op) 105.54 MB 105.52 MB 🟢 -0.02%
text_delete_all_100000/ (allocs/op) 566,133 allocs 566,072 allocs 🟢 -0.01%
text_100/ (ns/op) 234634.00 ns 236405.00 ns 🔴 +0.75%
text_100/ (B/op) 120.94 KB 120.95 KB 🔴 +0.01%
text_100/ (allocs/op) 5,181 allocs 5,182 allocs 🔴 +0.02%
text_1000/ (ns/op) 2.46 ms 2.49 ms 🔴 +1.16%
text_1000/ (B/op) 1.16 MB 1.16 MB 🔴 +0.03%
text_1000/ (allocs/op) 51,084 allocs 51,085 allocs ⚪ 0%
array_1000/ (ns/op) 1.24 ms 1.43 ms 🔴 +15.26%
array_1000/ (B/op) 1.09 MB 1.09 MB 🔴 +0.01%
array_1000/ (allocs/op) 11,879 allocs 11,881 allocs 🔴 +0.02%
array_10000/ (ns/op) 13.33 ms 13.37 ms 🔴 +0.24%
array_10000/ (B/op) 9.89 MB 9.89 MB ⚪ 0%
array_10000/ (allocs/op) 120,735 allocs 120,736 allocs ⚪ 0%
array_gc_100/ (ns/op) 131750.00 ns 134808.00 ns 🔴 +2.32%
array_gc_100/ (B/op) 99.89 KB 99.93 KB 🔴 +0.03%
array_gc_100/ (allocs/op) 1,266 allocs 1,267 allocs 🔴 +0.08%
array_gc_1000/ (ns/op) 1.42 ms 1.45 ms 🔴 +1.81%
array_gc_1000/ (B/op) 1.14 MB 1.14 MB ⚪ 0%
array_gc_1000/ (allocs/op) 12,926 allocs 12,927 allocs ⚪ 0%
counter_1000/ (ns/op) 202098.00 ns 207303.00 ns 🔴 +2.58%
counter_1000/ (B/op) 178.13 KB 178.18 KB 🔴 +0.03%
counter_1000/ (allocs/op) 5,771 allocs 5,772 allocs 🔴 +0.02%
counter_10000/ (ns/op) 2.17 ms 2.24 ms 🔴 +3.31%
counter_10000/ (B/op) 2.07 MB 2.07 MB ⚪ 0%
counter_10000/ (allocs/op) 59,778 allocs 59,779 allocs ⚪ 0%
object_1000/ (ns/op) 1.39 ms 1.44 ms 🔴 +3.72%
object_1000/ (B/op) 1.44 MB 1.44 MB ⚪ 0%
object_1000/ (allocs/op) 9,925 allocs 9,926 allocs 🔴 +0.01%
object_10000/ (ns/op) 14.82 ms 14.79 ms 🟢 -0.17%
object_10000/ (B/op) 12.35 MB 12.35 MB ⚪ 0%
object_10000/ (allocs/op) 101,232 allocs 101,231 allocs ⚪ 0%
tree_100/ (ns/op) 1.02 ms 1.08 ms 🔴 +5.80%
tree_100/ (B/op) 951.02 KB 951.08 KB ⚪ 0%
tree_100/ (allocs/op) 6,102 allocs 6,103 allocs 🔴 +0.02%
tree_1000/ (ns/op) 74.23 ms 79.26 ms 🔴 +6.77%
tree_1000/ (B/op) 86.58 MB 86.58 MB ⚪ 0%
tree_1000/ (allocs/op) 60,111 allocs 60,113 allocs ⚪ 0%
tree_10000/ (ns/op) 9.68 s 9.48 s 🟢 -2.08%
tree_10000/ (B/op) 8.58 GB 8.58 GB ⚪ 0%
tree_10000/ (allocs/op) 600,173 allocs 600,193 allocs ⚪ 0%
tree_delete_all_1000/ (ns/op) 78.41 ms 78.64 ms 🔴 +0.30%
tree_delete_all_1000/ (B/op) 87.57 MB 87.57 MB ⚪ 0%
tree_delete_all_1000/ (allocs/op) 75,289 allocs 75,291 allocs ⚪ 0%
tree_edit_gc_100/ (ns/op) 3.96 ms 3.88 ms 🟢 -2.14%
tree_edit_gc_100/ (B/op) 4.15 MB 4.15 MB ⚪ 0%
tree_edit_gc_100/ (allocs/op) 15,147 allocs 15,147 allocs ⚪ 0%
tree_edit_gc_1000/ (ns/op) 332.75 ms 318.99 ms 🟢 -4.13%
tree_edit_gc_1000/ (B/op) 384.04 MB 384.05 MB ⚪ 0%
tree_edit_gc_1000/ (allocs/op) 154,952 allocs 154,943 allocs ⚪ 0%
tree_split_gc_100/ (ns/op) 2.67 ms 2.66 ms 🟢 -0.41%
tree_split_gc_100/ (B/op) 2.41 MB 2.41 MB ⚪ 0%
tree_split_gc_100/ (allocs/op) 11,131 allocs 11,132 allocs ⚪ 0%
tree_split_gc_1000/ (ns/op) 197.74 ms 198.10 ms 🔴 +0.18%
tree_split_gc_1000/ (B/op) 222.50 MB 222.50 MB ⚪ 0%
tree_split_gc_1000/ (allocs/op) 122,053 allocs 122,075 allocs 🔴 +0.02%
BenchmarkRPC
Benchmark suite Previous Current Change
client_to_server/ (ns/op) 431.85 ms 418.93 ms 🟢 -2.99%
client_to_server/ (B/op) 16.13 MB 16.15 MB 🔴 +0.11%
client_to_server/ (allocs/op) 223,674 allocs 223,148 allocs 🟢 -0.24%
client_to_client_via_server/ (ns/op) 788.62 ms 560.24 ms 🟢 -28.96%
client_to_client_via_server/ (B/op) 37.20 MB 24.03 MB 🟢 -35.39%
client_to_client_via_server/ (allocs/op) 478,656 allocs 297,639 allocs 🟢 -37.82%
attach_large_document/ (ns/op) 1.32 s 1.23 s 🟢 -6.99%
attach_large_document/ (B/op) 1.89 GB 1.89 GB 🔴 +0.04%
attach_large_document/ (allocs/op) 12,321 allocs 12,401 allocs 🔴 +0.65%
adminCli_to_server/ (ns/op) 542.08 ms 543.70 ms 🔴 +0.30%
adminCli_to_server/ (B/op) 21.76 MB 21.33 MB 🟢 -1.97%
adminCli_to_server/ (allocs/op) 291,952 allocs 316,691 allocs 🔴 +8.47%
BenchmarkLocker
Benchmark suite Previous Current Change
(ns/op) 82.86 ns 94.46 ns 🔴 +14.00%
(B/op) 32.00 B 32.00 B ⚪ 0%
(allocs/op) 1 allocs 1 allocs ⚪ 0%
BenchmarkLockerParallel
Benchmark suite Previous Current Change
(ns/op) 45.80 ns 44.56 ns 🟢 -2.71%
(B/op) 0.00 B 0.00 B ⚪ 0%
(allocs/op) 0 allocs 0 allocs ⚪ 0%
BenchmarkLockerMoreKeys
Benchmark suite Previous Current Change
(ns/op) 180.50 ns 179.60 ns 🟢 -0.50%
(B/op) 31.00 B 31.00 B ⚪ 0%
(allocs/op) 0 allocs 0 allocs ⚪ 0%
BenchmarkRWLocker
Benchmark suite Previous Current Change
RWLock_rate_2/ (ns/op) 50.25 ns 49.90 ns 🟢 -0.70%
RWLock_rate_2/ (B/op) 0.00 B 0.00 B ⚪ 0%
RWLock_rate_2/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
RWLock_rate_10/ (ns/op) 44.88 ns 44.72 ns 🟢 -0.36%
RWLock_rate_10/ (B/op) 0.00 B 0.00 B ⚪ 0%
RWLock_rate_10/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
RWLock_rate_100/ (ns/op) 63.08 ns 60.76 ns 🟢 -3.68%
RWLock_rate_100/ (B/op) 2.00 B 2.00 B ⚪ 0%
RWLock_rate_100/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
RWLock_rate_1000/ (ns/op) 91.91 ns 89.97 ns 🟢 -2.11%
RWLock_rate_1000/ (B/op) 8.00 B 8.00 B ⚪ 0%
RWLock_rate_1000/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
BenchmarkChange
Benchmark suite Previous Current Change
Push_10_Changes/ (ns/op) 4.54 ms 4.52 ms 🟢 -0.50%
Push_10_Changes/ (B/op) 150.42 KB 150.87 KB 🔴 +0.30%
Push_10_Changes/ (allocs/op) 1,623 allocs 1,624 allocs 🔴 +0.06%
Push_100_Changes/ (ns/op) 16.52 ms 16.06 ms 🟢 -2.73%
Push_100_Changes/ (B/op) 770.59 KB 771.55 KB 🔴 +0.13%
Push_100_Changes/ (allocs/op) 8,509 allocs 8,509 allocs ⚪ 0%
Push_1000_Changes/ (ns/op) 129.20 ms 129.04 ms 🟢 -0.12%
Push_1000_Changes/ (B/op) 7.22 MB 7.38 MB 🔴 +2.23%
Push_1000_Changes/ (allocs/op) 79,325 allocs 79,328 allocs ⚪ 0%
Pull_10_Changes/ (ns/op) 3.70 ms 3.66 ms 🟢 -1.12%
Pull_10_Changes/ (B/op) 124.59 KB 124.40 KB 🟢 -0.15%
Pull_10_Changes/ (allocs/op) 1,456 allocs 1,454 allocs 🟢 -0.14%
Pull_100_Changes/ (ns/op) 5.32 ms 5.24 ms 🟢 -1.57%
Pull_100_Changes/ (B/op) 354.61 KB 354.98 KB 🔴 +0.11%
Pull_100_Changes/ (allocs/op) 5,182 allocs 5,182 allocs ⚪ 0%
Pull_1000_Changes/ (ns/op) 10.88 ms 10.46 ms 🟢 -3.82%
Pull_1000_Changes/ (B/op) 2.20 MB 2.20 MB 🟢 -0.02%
Pull_1000_Changes/ (allocs/op) 44,681 allocs 44,680 allocs ⚪ 0%
BenchmarkSnapshot
Benchmark suite Previous Current Change
Push_3KB_snapshot/ (ns/op) 19.55 ms 18.61 ms 🟢 -4.85%
Push_3KB_snapshot/ (B/op) 905.58 KB 905.98 KB 🔴 +0.04%
Push_3KB_snapshot/ (allocs/op) 8,516 allocs 8,512 allocs 🟢 -0.05%
Push_30KB_snapshot/ (ns/op) 132.18 ms 132.66 ms 🔴 +0.37%
Push_30KB_snapshot/ (B/op) 8.24 MB 8.13 MB 🟢 -1.35%
Push_30KB_snapshot/ (allocs/op) 89,008 allocs 86,442 allocs 🟢 -2.88%
Pull_3KB_snapshot/ (ns/op) 7.80 ms 7.39 ms 🟢 -5.33%
Pull_3KB_snapshot/ (B/op) 1.12 MB 1.06 MB 🟢 -4.81%
Pull_3KB_snapshot/ (allocs/op) 20,064 allocs 19,260 allocs 🟢 -4.01%
Pull_30KB_snapshot/ (ns/op) 19.91 ms 19.53 ms 🟢 -1.93%
Pull_30KB_snapshot/ (B/op) 9.31 MB 8.77 MB 🟢 -5.81%
Pull_30KB_snapshot/ (allocs/op) 193,610 allocs 185,672 allocs 🟢 -4.10%
BenchmarkSplayTree
Benchmark suite Previous Current Change
stress_test_100000/ (ns/op) 0.19 ns 0.19 ns ⚪ 0%
stress_test_100000/ (B/op) 0.00 B 0.00 B ⚪ 0%
stress_test_100000/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
stress_test_200000/ (ns/op) 0.40 ns 0.38 ns 🟢 -4.30%
stress_test_200000/ (B/op) 0.00 B 0.00 B ⚪ 0%
stress_test_200000/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
stress_test_300000/ (ns/op) 0.57 ns 0.59 ns 🔴 +4.01%
stress_test_300000/ (B/op) 0.00 B 0.00 B ⚪ 0%
stress_test_300000/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
random_access_100000/ (ns/op) 0.01 ns 0.01 ns 🟢 -0.31%
random_access_100000/ (B/op) 0.00 B 0.00 B ⚪ 0%
random_access_100000/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
random_access_200000/ (ns/op) 0.03 ns 0.03 ns 🟢 -0.25%
random_access_200000/ (B/op) 0.00 B 0.00 B ⚪ 0%
random_access_200000/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
random_access_300000/ (ns/op) 0.04 ns 0.05 ns 🔴 +3.28%
random_access_300000/ (B/op) 0.00 B 0.00 B ⚪ 0%
random_access_300000/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
editing_trace_bench/ (ns/op) 0.00 ns 0.00 ns 🟢 -12.62%
editing_trace_bench/ (B/op) 0.00 B 0.00 B ⚪ 0%
editing_trace_bench/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
BenchmarkSync
Benchmark suite Previous Current Change
memory_sync_10_test/ (ns/op) 7288.00 ns 7191.00 ns 🟢 -1.33%
memory_sync_10_test/ (B/op) 1.34 KB 1.34 KB ⚪ 0%
memory_sync_10_test/ (allocs/op) 35 allocs 35 allocs ⚪ 0%
memory_sync_100_test/ (ns/op) 55353.00 ns 55208.00 ns 🟢 -0.26%
memory_sync_100_test/ (B/op) 9.51 KB 9.50 KB 🟢 -0.02%
memory_sync_100_test/ (allocs/op) 268 allocs 268 allocs ⚪ 0%
memory_sync_1000_test/ (ns/op) 616285.00 ns 611942.00 ns 🟢 -0.70%
memory_sync_1000_test/ (B/op) 75.92 KB 76.20 KB 🔴 +0.37%
memory_sync_1000_test/ (allocs/op) 2,111 allocs 2,120 allocs 🔴 +0.43%
memory_sync_10000_test/ (ns/op) 7.47 ms 7.85 ms 🔴 +4.99%
memory_sync_10000_test/ (B/op) 761.49 KB 762.83 KB 🔴 +0.18%
memory_sync_10000_test/ (allocs/op) 20,475 allocs 20,493 allocs 🔴 +0.09%
BenchmarkTextEditing
Benchmark suite Previous Current Change
(ns/op) 5.18 s 5.19 s 🔴 +0.20%
(B/op) 3.92 GB 3.92 GB ⚪ 0%
(allocs/op) 20,619,777 allocs 20,619,738 allocs ⚪ 0%
BenchmarkTree
Benchmark suite Previous Current Change
10000_vertices_to_protobuf/ (ns/op) 4.17 ms 4.29 ms 🔴 +2.94%
10000_vertices_to_protobuf/ (B/op) 6.36 MB 6.36 MB ⚪ 0%
10000_vertices_to_protobuf/ (allocs/op) 70,025 allocs 70,025 allocs ⚪ 0%
10000_vertices_from_protobuf/ (ns/op) 217.30 ms 223.55 ms 🔴 +2.87%
10000_vertices_from_protobuf/ (B/op) 442.30 MB 442.30 MB ⚪ 0%
10000_vertices_from_protobuf/ (allocs/op) 290,038 allocs 290,039 allocs ⚪ 0%
20000_vertices_to_protobuf/ (ns/op) 8.84 ms 9.33 ms 🔴 +5.55%
20000_vertices_to_protobuf/ (B/op) 12.89 MB 12.89 MB ⚪ 0%
20000_vertices_to_protobuf/ (allocs/op) 140,028 allocs 140,028 allocs ⚪ 0%
20000_vertices_from_protobuf/ (ns/op) 884.61 ms 866.04 ms 🟢 -2.10%
20000_vertices_from_protobuf/ (B/op) 1.70 GB 1.70 GB ⚪ 0%
20000_vertices_from_protobuf/ (allocs/op) 580,043 allocs 580,088 allocs ⚪ 0%
30000_vertices_to_protobuf/ (ns/op) 14.26 ms 13.28 ms 🟢 -6.89%
30000_vertices_to_protobuf/ (B/op) 18.98 MB 18.98 MB ⚪ 0%
30000_vertices_to_protobuf/ (allocs/op) 210,029 allocs 210,029 allocs ⚪ 0%
30000_vertices_from_protobuf/ (ns/op) 2.00 s 2.01 s 🔴 +0.42%
30000_vertices_from_protobuf/ (B/op) 3.75 GB 3.75 GB ⚪ 0%
30000_vertices_from_protobuf/ (allocs/op) 870,147 allocs 870,142 allocs ⚪ 0%
BenchmarkVersionVector
Benchmark suite Previous Current Change
clients_10/ (ns/op) 160.21 ms 158.60 ms 🟢 -1.00%
clients_10/ (1_changepack(bytes)) 745.00 B 745.00 B ⚪ 0%
clients_10/ (2_snapshot(bytes)) 379.00 B 379.00 B ⚪ 0%
clients_10/ (3_pushpull(ms)) 8.00 ms 7.00 ms 🟢 -12.50%
clients_10/ (4_attach(ms)) 6.00 ms 6.00 ms ⚪ 0%
clients_10/ (5_changepack_after_detach(bytes)) 805.00 B 805.00 B ⚪ 0%
clients_10/ (6_snapshot_after_detach(bytes)) 136.00 B 136.00 B ⚪ 0%
clients_10/ (7_pushpull_after_detach(ms)) 8.00 ms 10.00 ms 🔴 +25.00%
clients_10/ (B/op) 19.93 MB 20.03 MB 🔴 +0.49%
clients_10/ (allocs/op) 83,762 allocs 83,230 allocs 🟢 -0.64%
clients_100/ (ns/op) 1.41 s 1.41 s 🟢 -0.41%
clients_100/ (1_changepack(bytes)) 6.14 KB 6.14 KB ⚪ 0%
clients_100/ (2_snapshot(bytes)) 3.08 KB 3.08 KB ⚪ 0%
clients_100/ (3_pushpull(ms)) 11.00 ms 11.00 ms ⚪ 0%
clients_100/ (4_attach(ms)) 11.00 ms 9.00 ms 🟢 -18.18%
clients_100/ (5_changepack_after_detach(bytes)) 6.21 KB 6.21 KB ⚪ 0%
clients_100/ (6_snapshot_after_detach(bytes)) 137.00 B 137.00 B ⚪ 0%
clients_100/ (7_pushpull_after_detach(ms)) 9.00 ms 9.00 ms ⚪ 0%
clients_100/ (B/op) 230.31 MB 223.58 MB 🟢 -2.92%
clients_100/ (allocs/op) 1,539,768 allocs 1,481,585 allocs 🟢 -3.78%
clients_1000/ (ns/op) 60.97 s 45.07 s 🟢 -26.08%
clients_1000/ (1_changepack(bytes)) 60.16 KB 60.16 KB ⚪ 0%
clients_1000/ (2_snapshot(bytes)) 30.08 KB 30.08 KB ⚪ 0%
clients_1000/ (3_pushpull(ms)) 95.00 ms 91.00 ms 🟢 -4.21%
clients_1000/ (4_attach(ms)) 249.00 ms 100.00 ms 🟢 -59.84%
clients_1000/ (5_changepack_after_detach(bytes)) 60.22 KB 60.22 KB ⚪ 0%
clients_1000/ (6_snapshot_after_detach(bytes)) 139.00 B 139.00 B ⚪ 0%
clients_1000/ (7_pushpull_after_detach(ms)) 26.00 ms 21.00 ms 🟢 -19.23%
clients_1000/ (B/op) 22.07 GB 6.43 GB 🟢 -70.86%
clients_1000/ (allocs/op) 111,762,106 allocs 93,354,307 allocs 🟢 -16.47%

@hackerwins-yorkie hackerwins-yorkie left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Go Benchmark Analysis 📊

This is a comparison result between the previous(c7797cf) and the current commit(ebc525a).

Significant Changes (≥20% difference)

Benchmark suite Previous Current Change
BenchmarkRPC/client_to_client_via_server/ (B/op) 39.09 MB 24.58 MB 🟢 -37.13%
BenchmarkRPC/client_to_client_via_server/ (allocs/op) 470,568 allocs 300,624 allocs 🟢 -36.11%
BenchmarkRPC/client_to_client_via_server/ (ns/op) 771.40 ms 569.97 ms 🟢 -26.11%
BenchmarkSplayTree/random_access_200000/ (ns/op) 0.03 ns 0.03 ns 🔴 +20.81%

Key Observations 🔍

  • BenchmarkRPC:

    • BenchmarkRPC client_to_client_via_server demonstrated significant improvements across different metrics:
      • Bytes per operation reduced by 37.13%.
      • Allocations per operation decreased by 36.11%.
      • Nanoseconds per operation improved by 26.11%.
    • In contrast, a slight increase of 1.46% was observed in the client_to_server operation in terms of nanoseconds per operation.
  • BenchmarkTextEditing:

    • The benchmark suite for text editing showed a notable increase of 1.79% in nanoseconds per operation, indicating a slight performance degradation.
  • BenchmarkTree:

    • The 10000_vertices_to_protobuf operation experienced a 4.47% increase in nanoseconds per operation, while the 20000_vertices_from_protobuf operation showed a 2.95% increase in the same metric.
    • Conversely, the 30000_vertices_from_protobuf operation saw a minimal improvement of 0.36% in nanoseconds per operation.
  • Overall Trend:

    • Several benchmarks displayed minor fluctuations, with some operations showcasing improvements and others having slight deteriorations.
    • Across the various benchmark suites, improvements were more prevalent than deteriorations, indicating overall positive performance trends.

In this analysis, noticeable optimizations were observed in certain benchmark suites, contributing to enhanced performance metrics.

Detailed Test Results

BenchmarkDocument
Benchmark suite Previous Current Change
constructor_test/ (ns/op) 1472.00 ns 1487.00 ns 🔴 +1.02%
constructor_test/ (B/op) 1.43 KB 1.43 KB ⚪ 0%
constructor_test/ (allocs/op) 25 allocs 25 allocs ⚪ 0%
status_test/ (ns/op) 1334.00 ns 1068.00 ns 🟢 -19.94%
status_test/ (B/op) 1.40 KB 1.40 KB ⚪ 0%
status_test/ (allocs/op) 23 allocs 23 allocs ⚪ 0%
equals_test/ (ns/op) 7938.00 ns 7953.00 ns 🔴 +0.19%
equals_test/ (B/op) 7.71 KB 7.71 KB ⚪ 0%
equals_test/ (allocs/op) 132 allocs 132 allocs ⚪ 0%
nested_update_test/ (ns/op) 17081.00 ns 16958.00 ns 🟢 -0.72%
nested_update_test/ (B/op) 12.36 KB 12.36 KB ⚪ 0%
nested_update_test/ (allocs/op) 259 allocs 259 allocs ⚪ 0%
delete_test/ (ns/op) 22790.00 ns 22875.00 ns 🔴 +0.37%
delete_test/ (B/op) 15.84 KB 15.84 KB ⚪ 0%
delete_test/ (allocs/op) 340 allocs 340 allocs ⚪ 0%
object_test/ (ns/op) 8539.00 ns 8553.00 ns 🔴 +0.16%
object_test/ (B/op) 7.08 KB 7.08 KB 🔴 +0.01%
object_test/ (allocs/op) 119 allocs 119 allocs ⚪ 0%
array_test/ (ns/op) 28405.00 ns 28866.00 ns 🔴 +1.62%
array_test/ (B/op) 12.19 KB 12.19 KB ⚪ 0%
array_test/ (allocs/op) 274 allocs 274 allocs ⚪ 0%
text_test/ (ns/op) 31656.00 ns 33568.00 ns 🔴 +6.04%
text_test/ (B/op) 15.24 KB 15.24 KB ⚪ 0%
text_test/ (allocs/op) 485 allocs 485 allocs ⚪ 0%
text_composition_test/ (ns/op) 31389.00 ns 31614.00 ns 🔴 +0.72%
text_composition_test/ (B/op) 18.75 KB 18.75 KB ⚪ 0%
text_composition_test/ (allocs/op) 502 allocs 502 allocs ⚪ 0%
rich_text_test/ (ns/op) 86962.00 ns 85130.00 ns 🟢 -2.11%
rich_text_test/ (B/op) 39.41 KB 39.40 KB 🟢 -0.02%
rich_text_test/ (allocs/op) 1,147 allocs 1,147 allocs ⚪ 0%
counter_test/ (ns/op) 18075.00 ns 18613.00 ns 🔴 +2.98%
counter_test/ (B/op) 11.86 KB 11.86 KB ⚪ 0%
counter_test/ (allocs/op) 254 allocs 254 allocs ⚪ 0%
text_edit_gc_100/ (ns/op) 1.38 ms 1.39 ms 🔴 +0.70%
text_edit_gc_100/ (B/op) 864.90 KB 864.90 KB ⚪ 0%
text_edit_gc_100/ (allocs/op) 17,282 allocs 17,282 allocs ⚪ 0%
text_edit_gc_1000/ (ns/op) 52.51 ms 53.03 ms 🔴 +1.00%
text_edit_gc_1000/ (B/op) 46.84 MB 46.84 MB ⚪ 0%
text_edit_gc_1000/ (allocs/op) 185,593 allocs 185,590 allocs ⚪ 0%
text_split_gc_100/ (ns/op) 2.09 ms 2.10 ms 🔴 +0.54%
text_split_gc_100/ (B/op) 1.58 MB 1.58 MB ⚪ 0%
text_split_gc_100/ (allocs/op) 15,952 allocs 15,951 allocs ⚪ 0%
text_split_gc_1000/ (ns/op) 127.97 ms 129.64 ms 🔴 +1.31%
text_split_gc_1000/ (B/op) 137.79 MB 137.79 MB ⚪ 0%
text_split_gc_1000/ (allocs/op) 184,998 allocs 184,991 allocs ⚪ 0%
text_delete_all_10000/ (ns/op) 16.81 ms 17.41 ms 🔴 +3.54%
text_delete_all_10000/ (B/op) 10.58 MB 10.58 MB ⚪ 0%
text_delete_all_10000/ (allocs/op) 56,138 allocs 56,138 allocs ⚪ 0%
text_delete_all_100000/ (ns/op) 290.19 ms 293.08 ms 🔴 +1.00%
text_delete_all_100000/ (B/op) 105.54 MB 105.53 MB ⚪ 0%
text_delete_all_100000/ (allocs/op) 566,122 allocs 566,115 allocs ⚪ 0%
text_100/ (ns/op) 228221.00 ns 239975.00 ns 🔴 +5.15%
text_100/ (B/op) 120.95 KB 120.99 KB 🔴 +0.03%
text_100/ (allocs/op) 5,182 allocs 5,182 allocs ⚪ 0%
text_1000/ (ns/op) 2.43 ms 2.50 ms 🔴 +2.73%
text_1000/ (B/op) 1.16 MB 1.16 MB ⚪ 0%
text_1000/ (allocs/op) 51,085 allocs 51,085 allocs ⚪ 0%
array_1000/ (ns/op) 1.24 ms 1.27 ms 🔴 +2.66%
array_1000/ (B/op) 1.09 MB 1.09 MB 🔴 +0.02%
array_1000/ (allocs/op) 11,880 allocs 11,880 allocs ⚪ 0%
array_10000/ (ns/op) 13.36 ms 13.43 ms 🔴 +0.59%
array_10000/ (B/op) 9.89 MB 9.89 MB ⚪ 0%
array_10000/ (allocs/op) 120,736 allocs 120,735 allocs ⚪ 0%
array_gc_100/ (ns/op) 131033.00 ns 137279.00 ns 🔴 +4.77%
array_gc_100/ (B/op) 99.93 KB 99.93 KB ⚪ 0%
array_gc_100/ (allocs/op) 1,267 allocs 1,267 allocs ⚪ 0%
array_gc_1000/ (ns/op) 1.41 ms 1.45 ms 🔴 +3.25%
array_gc_1000/ (B/op) 1.14 MB 1.14 MB ⚪ 0%
array_gc_1000/ (allocs/op) 12,927 allocs 12,928 allocs ⚪ 0%
counter_1000/ (ns/op) 199973.00 ns 207772.00 ns 🔴 +3.90%
counter_1000/ (B/op) 178.18 KB 178.19 KB ⚪ 0%
counter_1000/ (allocs/op) 5,772 allocs 5,772 allocs ⚪ 0%
counter_10000/ (ns/op) 2.14 ms 2.18 ms 🔴 +1.68%
counter_10000/ (B/op) 2.07 MB 2.07 MB ⚪ 0%
counter_10000/ (allocs/op) 59,779 allocs 59,779 allocs ⚪ 0%
object_1000/ (ns/op) 1.41 ms 1.46 ms 🔴 +3.56%
object_1000/ (B/op) 1.44 MB 1.44 MB ⚪ 0%
object_1000/ (allocs/op) 9,926 allocs 9,926 allocs ⚪ 0%
object_10000/ (ns/op) 14.97 ms 15.18 ms 🔴 +1.38%
object_10000/ (B/op) 12.35 MB 12.35 MB ⚪ 0%
object_10000/ (allocs/op) 101,232 allocs 101,230 allocs ⚪ 0%
tree_100/ (ns/op) 1.04 ms 1.08 ms 🔴 +4.09%
tree_100/ (B/op) 951.08 KB 951.08 KB ⚪ 0%
tree_100/ (allocs/op) 6,103 allocs 6,103 allocs ⚪ 0%
tree_1000/ (ns/op) 74.45 ms 79.89 ms 🔴 +7.31%
tree_1000/ (B/op) 86.58 MB 86.58 MB ⚪ 0%
tree_1000/ (allocs/op) 60,113 allocs 60,113 allocs ⚪ 0%
tree_10000/ (ns/op) 9.39 s 9.61 s 🔴 +2.35%
tree_10000/ (B/op) 8.58 GB 8.58 GB ⚪ 0%
tree_10000/ (allocs/op) 600,205 allocs 600,187 allocs ⚪ 0%
tree_delete_all_1000/ (ns/op) 77.01 ms 79.83 ms 🔴 +3.66%
tree_delete_all_1000/ (B/op) 87.57 MB 87.57 MB ⚪ 0%
tree_delete_all_1000/ (allocs/op) 75,291 allocs 75,291 allocs ⚪ 0%
tree_edit_gc_100/ (ns/op) 3.83 ms 3.96 ms 🔴 +3.27%
tree_edit_gc_100/ (B/op) 4.15 MB 4.15 MB ⚪ 0%
tree_edit_gc_100/ (allocs/op) 15,147 allocs 15,147 allocs ⚪ 0%
tree_edit_gc_1000/ (ns/op) 314.96 ms 328.08 ms 🔴 +4.16%
tree_edit_gc_1000/ (B/op) 384.04 MB 384.04 MB ⚪ 0%
tree_edit_gc_1000/ (allocs/op) 154,937 allocs 154,932 allocs ⚪ 0%
tree_split_gc_100/ (ns/op) 2.59 ms 2.71 ms 🔴 +4.26%
tree_split_gc_100/ (B/op) 2.41 MB 2.41 MB ⚪ 0%
tree_split_gc_100/ (allocs/op) 11,132 allocs 11,132 allocs ⚪ 0%
tree_split_gc_1000/ (ns/op) 189.14 ms 204.39 ms 🔴 +8.06%
tree_split_gc_1000/ (B/op) 222.50 MB 222.50 MB ⚪ 0%
tree_split_gc_1000/ (allocs/op) 122,064 allocs 122,068 allocs ⚪ 0%
BenchmarkRPC
Benchmark suite Previous Current Change
client_to_server/ (ns/op) 420.53 ms 426.69 ms 🔴 +1.46%
client_to_server/ (B/op) 17.87 MB 16.14 MB 🟢 -9.69%
client_to_server/ (allocs/op) 223,725 allocs 223,812 allocs 🔴 +0.04%
client_to_client_via_server/ (ns/op) 771.40 ms 569.97 ms 🟢 -26.11%
client_to_client_via_server/ (B/op) 39.09 MB 24.58 MB 🟢 -37.13%
client_to_client_via_server/ (allocs/op) 470,568 allocs 300,624 allocs 🟢 -36.11%
attach_large_document/ (ns/op) 1.26 s 1.23 s 🟢 -2.06%
attach_large_document/ (B/op) 1.90 GB 1.90 GB 🟢 -0.02%
attach_large_document/ (allocs/op) 12,439 allocs 12,451 allocs 🔴 +0.10%
adminCli_to_server/ (ns/op) 543.02 ms 553.35 ms 🔴 +1.90%
adminCli_to_server/ (B/op) 21.30 MB 21.33 MB 🔴 +0.11%
adminCli_to_server/ (allocs/op) 316,652 allocs 316,721 allocs 🔴 +0.02%
BenchmarkLocker
Benchmark suite Previous Current Change
(ns/op) 85.81 ns 84.27 ns 🟢 -1.79%
(B/op) 32.00 B 32.00 B ⚪ 0%
(allocs/op) 1 allocs 1 allocs ⚪ 0%
BenchmarkLockerParallel
Benchmark suite Previous Current Change
(ns/op) 45.89 ns 45.67 ns 🟢 -0.48%
(B/op) 0.00 B 0.00 B ⚪ 0%
(allocs/op) 0 allocs 0 allocs ⚪ 0%
BenchmarkLockerMoreKeys
Benchmark suite Previous Current Change
(ns/op) 187.90 ns 175.20 ns 🟢 -6.76%
(B/op) 30.00 B 31.00 B 🔴 +3.33%
(allocs/op) 0 allocs 0 allocs ⚪ 0%
BenchmarkRWLocker
Benchmark suite Previous Current Change
RWLock_rate_2/ (ns/op) 50.93 ns 50.59 ns 🟢 -0.67%
RWLock_rate_2/ (B/op) 0.00 B 0.00 B ⚪ 0%
RWLock_rate_2/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
RWLock_rate_10/ (ns/op) 45.77 ns 43.76 ns 🟢 -4.39%
RWLock_rate_10/ (B/op) 0.00 B 0.00 B ⚪ 0%
RWLock_rate_10/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
RWLock_rate_100/ (ns/op) 61.23 ns 58.79 ns 🟢 -3.98%
RWLock_rate_100/ (B/op) 2.00 B 2.00 B ⚪ 0%
RWLock_rate_100/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
RWLock_rate_1000/ (ns/op) 89.26 ns 86.90 ns 🟢 -2.64%
RWLock_rate_1000/ (B/op) 8.00 B 8.00 B ⚪ 0%
RWLock_rate_1000/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
BenchmarkChange
Benchmark suite Previous Current Change
Push_10_Changes/ (ns/op) 4.49 ms 4.52 ms 🔴 +0.81%
Push_10_Changes/ (B/op) 150.94 KB 150.40 KB 🟢 -0.36%
Push_10_Changes/ (allocs/op) 1,625 allocs 1,624 allocs 🟢 -0.06%
Push_100_Changes/ (ns/op) 16.40 ms 16.81 ms 🔴 +2.49%
Push_100_Changes/ (B/op) 776.10 KB 773.33 KB 🟢 -0.36%
Push_100_Changes/ (allocs/op) 8,511 allocs 8,514 allocs 🔴 +0.04%
Push_1000_Changes/ (ns/op) 131.30 ms 133.03 ms 🔴 +1.32%
Push_1000_Changes/ (B/op) 7.18 MB 7.17 MB 🟢 -0.11%
Push_1000_Changes/ (allocs/op) 79,325 allocs 79,326 allocs ⚪ 0%
Pull_10_Changes/ (ns/op) 3.69 ms 3.69 ms 🟢 -0.08%
Pull_10_Changes/ (B/op) 124.60 KB 124.36 KB 🟢 -0.19%
Pull_10_Changes/ (allocs/op) 1,454 allocs 1,454 allocs ⚪ 0%
Pull_100_Changes/ (ns/op) 5.26 ms 5.25 ms 🟢 -0.13%
Pull_100_Changes/ (B/op) 354.65 KB 354.35 KB 🟢 -0.09%
Pull_100_Changes/ (allocs/op) 5,180 allocs 5,180 allocs ⚪ 0%
Pull_1000_Changes/ (ns/op) 10.49 ms 10.80 ms 🔴 +2.94%
Pull_1000_Changes/ (B/op) 2.20 MB 2.20 MB 🔴 +0.01%
Pull_1000_Changes/ (allocs/op) 44,680 allocs 44,681 allocs ⚪ 0%
BenchmarkSnapshot
Benchmark suite Previous Current Change
Push_3KB_snapshot/ (ns/op) 18.53 ms 18.89 ms 🔴 +1.96%
Push_3KB_snapshot/ (B/op) 902.00 KB 906.62 KB 🔴 +0.51%
Push_3KB_snapshot/ (allocs/op) 8,514 allocs 8,515 allocs 🔴 +0.01%
Push_30KB_snapshot/ (ns/op) 132.49 ms 134.84 ms 🔴 +1.77%
Push_30KB_snapshot/ (B/op) 8.01 MB 8.13 MB 🔴 +1.49%
Push_30KB_snapshot/ (allocs/op) 86,458 allocs 87,783 allocs 🔴 +1.53%
Pull_3KB_snapshot/ (ns/op) 7.36 ms 7.42 ms 🔴 +0.82%
Pull_3KB_snapshot/ (B/op) 1.06 MB 1.06 MB ⚪ 0%
Pull_3KB_snapshot/ (allocs/op) 19,256 allocs 19,261 allocs 🔴 +0.03%
Pull_30KB_snapshot/ (ns/op) 19.29 ms 19.33 ms 🔴 +0.18%
Pull_30KB_snapshot/ (B/op) 8.77 MB 8.77 MB 🔴 +0.03%
Pull_30KB_snapshot/ (allocs/op) 185,629 allocs 185,674 allocs 🔴 +0.02%
BenchmarkSplayTree
Benchmark suite Previous Current Change
stress_test_100000/ (ns/op) 0.20 ns 0.20 ns 🔴 +0.05%
stress_test_100000/ (B/op) 0.00 B 0.00 B ⚪ 0%
stress_test_100000/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
stress_test_200000/ (ns/op) 0.38 ns 0.39 ns 🔴 +2.65%
stress_test_200000/ (B/op) 0.00 B 0.00 B ⚪ 0%
stress_test_200000/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
stress_test_300000/ (ns/op) 0.60 ns 0.57 ns 🟢 -5.47%
stress_test_300000/ (B/op) 0.00 B 0.00 B ⚪ 0%
stress_test_300000/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
random_access_100000/ (ns/op) 0.01 ns 0.01 ns 🟢 -1.82%
random_access_100000/ (B/op) 0.00 B 0.00 B ⚪ 0%
random_access_100000/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
random_access_200000/ (ns/op) 0.03 ns 0.03 ns 🔴 +20.81%
random_access_200000/ (B/op) 0.00 B 0.00 B ⚪ 0%
random_access_200000/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
random_access_300000/ (ns/op) 0.04 ns 0.04 ns 🔴 +1.67%
random_access_300000/ (B/op) 0.00 B 0.00 B ⚪ 0%
random_access_300000/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
editing_trace_bench/ (ns/op) 0.00 ns 0.00 ns 🔴 +5.54%
editing_trace_bench/ (B/op) 0.00 B 0.00 B ⚪ 0%
editing_trace_bench/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
BenchmarkSync
Benchmark suite Previous Current Change
memory_sync_10_test/ (ns/op) 7057.00 ns 7372.00 ns 🔴 +4.46%
memory_sync_10_test/ (B/op) 1.34 KB 1.34 KB ⚪ 0%
memory_sync_10_test/ (allocs/op) 35 allocs 35 allocs ⚪ 0%
memory_sync_100_test/ (ns/op) 54760.00 ns 55597.00 ns 🔴 +1.53%
memory_sync_100_test/ (B/op) 9.53 KB 9.51 KB 🟢 -0.28%
memory_sync_100_test/ (allocs/op) 269 allocs 268 allocs 🟢 -0.37%
memory_sync_1000_test/ (ns/op) 617621.00 ns 605178.00 ns 🟢 -2.01%
memory_sync_1000_test/ (B/op) 75.63 KB 76.69 KB 🔴 +1.40%
memory_sync_1000_test/ (allocs/op) 2,103 allocs 2,135 allocs 🔴 +1.52%
memory_sync_10000_test/ (ns/op) 7.83 ms 7.77 ms 🟢 -0.75%
memory_sync_10000_test/ (B/op) 752.23 KB 763.57 KB 🔴 +1.51%
memory_sync_10000_test/ (allocs/op) 20,417 allocs 20,501 allocs 🔴 +0.41%
BenchmarkTextEditing
Benchmark suite Previous Current Change
(ns/op) 5.20 s 5.29 s 🔴 +1.79%
(B/op) 3.92 GB 3.92 GB ⚪ 0%
(allocs/op) 20,619,784 allocs 20,619,755 allocs ⚪ 0%
BenchmarkTree
Benchmark suite Previous Current Change
10000_vertices_to_protobuf/ (ns/op) 4.29 ms 4.48 ms 🔴 +4.47%
10000_vertices_to_protobuf/ (B/op) 6.36 MB 6.36 MB ⚪ 0%
10000_vertices_to_protobuf/ (allocs/op) 70,025 allocs 70,025 allocs ⚪ 0%
10000_vertices_from_protobuf/ (ns/op) 222.46 ms 229.02 ms 🔴 +2.95%
10000_vertices_from_protobuf/ (B/op) 442.31 MB 442.30 MB ⚪ 0%
10000_vertices_from_protobuf/ (allocs/op) 290,039 allocs 290,039 allocs ⚪ 0%
20000_vertices_to_protobuf/ (ns/op) 9.14 ms 9.34 ms 🔴 +2.19%
20000_vertices_to_protobuf/ (B/op) 12.89 MB 12.89 MB ⚪ 0%
20000_vertices_to_protobuf/ (allocs/op) 140,028 allocs 140,028 allocs ⚪ 0%
20000_vertices_from_protobuf/ (ns/op) 877.37 ms 877.92 ms 🔴 +0.06%
20000_vertices_from_protobuf/ (B/op) 1.70 GB 1.70 GB ⚪ 0%
20000_vertices_from_protobuf/ (allocs/op) 580,090 allocs 580,044 allocs ⚪ 0%
30000_vertices_to_protobuf/ (ns/op) 13.15 ms 14.20 ms 🔴 +7.98%
30000_vertices_to_protobuf/ (B/op) 18.98 MB 18.98 MB ⚪ 0%
30000_vertices_to_protobuf/ (allocs/op) 210,029 allocs 210,029 allocs ⚪ 0%
30000_vertices_from_protobuf/ (ns/op) 2.02 s 2.01 s 🟢 -0.36%
30000_vertices_from_protobuf/ (B/op) 3.75 GB 3.75 GB ⚪ 0%
30000_vertices_from_protobuf/ (allocs/op) 870,086 allocs 870,142 allocs ⚪ 0%
BenchmarkVersionVector
Benchmark suite Previous Current Change
clients_10/ (ns/op) 157.85 ms 160.23 ms 🔴 +1.51%
clients_10/ (1_changepack(bytes)) 745.00 B 745.00 B ⚪ 0%
clients_10/ (2_snapshot(bytes)) 379.00 B 379.00 B ⚪ 0%
clients_10/ (3_pushpull(ms)) 7.00 ms 8.00 ms 🔴 +14.29%
clients_10/ (4_attach(ms)) 6.00 ms 6.00 ms ⚪ 0%
clients_10/ (5_changepack_after_detach(bytes)) 805.00 B 805.00 B ⚪ 0%
clients_10/ (6_snapshot_after_detach(bytes)) 136.00 B 136.00 B ⚪ 0%
clients_10/ (7_pushpull_after_detach(ms)) 8.00 ms 8.00 ms ⚪ 0%
clients_10/ (B/op) 20.71 MB 18.86 MB 🟢 -8.93%
clients_10/ (allocs/op) 83,248 allocs 83,206 allocs 🟢 -0.05%
clients_100/ (ns/op) 1.39 s 1.43 s 🔴 +2.98%
clients_100/ (1_changepack(bytes)) 6.14 KB 6.14 KB ⚪ 0%
clients_100/ (2_snapshot(bytes)) 3.08 KB 3.08 KB ⚪ 0%
clients_100/ (3_pushpull(ms)) 11.00 ms 12.00 ms 🔴 +9.09%
clients_100/ (4_attach(ms)) 9.00 ms 10.00 ms 🔴 +11.11%
clients_100/ (5_changepack_after_detach(bytes)) 6.21 KB 6.21 KB ⚪ 0%
clients_100/ (6_snapshot_after_detach(bytes)) 137.00 B 137.00 B ⚪ 0%
clients_100/ (7_pushpull_after_detach(ms)) 9.00 ms 10.00 ms 🔴 +11.11%
clients_100/ (B/op) 213.58 MB 215.21 MB 🔴 +0.76%
clients_100/ (allocs/op) 1,481,342 allocs 1,481,377 allocs ⚪ 0%
clients_1000/ (ns/op) 42.35 s 43.72 s 🔴 +3.23%
clients_1000/ (1_changepack(bytes)) 60.16 KB 60.16 KB ⚪ 0%
clients_1000/ (2_snapshot(bytes)) 30.08 KB 30.08 KB ⚪ 0%
clients_1000/ (3_pushpull(ms)) 116.00 ms 113.00 ms 🟢 -2.59%
clients_1000/ (4_attach(ms)) 72.00 ms 73.00 ms 🔴 +1.39%
clients_1000/ (5_changepack_after_detach(bytes)) 60.22 KB 60.22 KB ⚪ 0%
clients_1000/ (6_snapshot_after_detach(bytes)) 139.00 B 139.00 B ⚪ 0%
clients_1000/ (7_pushpull_after_detach(ms)) 27.00 ms 23.00 ms 🟢 -14.81%
clients_1000/ (B/op) 6.43 GB 6.43 GB ⚪ 0%
clients_1000/ (allocs/op) 93,354,528 allocs 93,355,099 allocs ⚪ 0%

@hackerwins-yorkie hackerwins-yorkie left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Go Benchmark Analysis 📊

This is a comparison result between the previous(68c233b) and the current commit(9569cc7).

Significant Changes (≥20% difference)

Benchmark suite Previous Current Change
BenchmarkDocument/nested_update_test/ (ns/op) 16818.00 ns 20544.00 ns 🔴 +22.15%

Key Observations 🔍

  • The benchmark suite BenchmarkDocument shows a significant increase of +22.15% in the nested_update_test operation, from 16818.00 ns/op to 20544.00 ns/op.
  • Across various benchmark suites, there are noticeable improvements in performance (🟢) for operations like array_test, rich_text_test, array_1000, and tree_split_gc_1000, indicating optimization or efficiency gains.
  • Some operations, such as BenchmarkChange/Push_1000_Changes and BenchmarkVersionVector/clients_1000, have shown slight performance declines (🔴), suggesting potential areas for further investigation or optimization.

Overall, the data highlights both positive and negative performance changes in different benchmark suites, indicating a mix of improvements and areas that may require attention.

Detailed Test Results

BenchmarkDocument
Benchmark suite Previous Current Change
constructor_test/ (ns/op) 1475.00 ns 1506.00 ns 🔴 +2.10%
constructor_test/ (B/op) 1.43 KB 1.43 KB ⚪ 0%
constructor_test/ (allocs/op) 25 allocs 25 allocs ⚪ 0%
status_test/ (ns/op) 1070.00 ns 1092.00 ns 🔴 +2.06%
status_test/ (B/op) 1.40 KB 1.40 KB ⚪ 0%
status_test/ (allocs/op) 23 allocs 23 allocs ⚪ 0%
equals_test/ (ns/op) 7923.00 ns 7942.00 ns 🔴 +0.24%
equals_test/ (B/op) 7.71 KB 7.71 KB ⚪ 0%
equals_test/ (allocs/op) 132 allocs 132 allocs ⚪ 0%
nested_update_test/ (ns/op) 16818.00 ns 20544.00 ns 🔴 +22.15%
nested_update_test/ (B/op) 12.36 KB 12.36 KB ⚪ 0%
nested_update_test/ (allocs/op) 259 allocs 259 allocs ⚪ 0%
delete_test/ (ns/op) 22897.00 ns 23117.00 ns 🔴 +0.96%
delete_test/ (B/op) 15.84 KB 15.84 KB ⚪ 0%
delete_test/ (allocs/op) 340 allocs 340 allocs ⚪ 0%
object_test/ (ns/op) 8584.00 ns 8681.00 ns 🔴 +1.13%
object_test/ (B/op) 7.08 KB 7.08 KB ⚪ 0%
object_test/ (allocs/op) 119 allocs 119 allocs ⚪ 0%
array_test/ (ns/op) 30978.00 ns 28587.00 ns 🟢 -7.72%
array_test/ (B/op) 12.19 KB 12.19 KB ⚪ 0%
array_test/ (allocs/op) 274 allocs 274 allocs ⚪ 0%
text_test/ (ns/op) 31716.00 ns 31756.00 ns 🔴 +0.13%
text_test/ (B/op) 15.24 KB 15.24 KB ⚪ 0%
text_test/ (allocs/op) 485 allocs 485 allocs ⚪ 0%
text_composition_test/ (ns/op) 31494.00 ns 31497.00 ns ⚪ 0%
text_composition_test/ (B/op) 18.75 KB 18.75 KB ⚪ 0%
text_composition_test/ (allocs/op) 502 allocs 502 allocs ⚪ 0%
rich_text_test/ (ns/op) 86630.00 ns 85755.00 ns 🟢 -1.01%
rich_text_test/ (B/op) 39.40 KB 39.41 KB 🔴 +0.02%
rich_text_test/ (allocs/op) 1,147 allocs 1,147 allocs ⚪ 0%
counter_test/ (ns/op) 18162.00 ns 18295.00 ns 🔴 +0.73%
counter_test/ (B/op) 11.86 KB 11.86 KB ⚪ 0%
counter_test/ (allocs/op) 254 allocs 254 allocs ⚪ 0%
text_edit_gc_100/ (ns/op) 1.38 ms 1.39 ms 🔴 +0.69%
text_edit_gc_100/ (B/op) 864.94 KB 864.99 KB ⚪ 0%
text_edit_gc_100/ (allocs/op) 17,282 allocs 17,282 allocs ⚪ 0%
text_edit_gc_1000/ (ns/op) 52.60 ms 53.84 ms 🔴 +2.35%
text_edit_gc_1000/ (B/op) 46.84 MB 46.84 MB ⚪ 0%
text_edit_gc_1000/ (allocs/op) 185,598 allocs 185,583 allocs ⚪ 0%
text_split_gc_100/ (ns/op) 2.10 ms 2.11 ms 🔴 +0.80%
text_split_gc_100/ (B/op) 1.58 MB 1.58 MB ⚪ 0%
text_split_gc_100/ (allocs/op) 15,951 allocs 15,951 allocs ⚪ 0%
text_split_gc_1000/ (ns/op) 127.99 ms 128.81 ms 🔴 +0.64%
text_split_gc_1000/ (B/op) 137.79 MB 137.79 MB ⚪ 0%
text_split_gc_1000/ (allocs/op) 184,982 allocs 184,998 allocs ⚪ 0%
text_delete_all_10000/ (ns/op) 17.22 ms 17.31 ms 🔴 +0.53%
text_delete_all_10000/ (B/op) 10.58 MB 10.57 MB 🟢 -0.02%
text_delete_all_10000/ (allocs/op) 56,134 allocs 56,129 allocs ⚪ 0%
text_delete_all_100000/ (ns/op) 299.69 ms 265.25 ms 🟢 -11.49%
text_delete_all_100000/ (B/op) 105.53 MB 105.54 MB ⚪ 0%
text_delete_all_100000/ (allocs/op) 566,117 allocs 566,025 allocs 🟢 -0.02%
text_100/ (ns/op) 246721.00 ns 234010.00 ns 🟢 -5.15%
text_100/ (B/op) 120.95 KB 120.95 KB ⚪ 0%
text_100/ (allocs/op) 5,182 allocs 5,182 allocs ⚪ 0%
text_1000/ (ns/op) 2.56 ms 2.49 ms 🟢 -2.79%
text_1000/ (B/op) 1.16 MB 1.16 MB ⚪ 0%
text_1000/ (allocs/op) 51,085 allocs 51,085 allocs ⚪ 0%
array_1000/ (ns/op) 1.31 ms 1.28 ms 🟢 -2.87%
array_1000/ (B/op) 1.09 MB 1.09 MB 🔴 +0.02%
array_1000/ (allocs/op) 11,880 allocs 11,881 allocs ⚪ 0%
array_10000/ (ns/op) 13.65 ms 13.47 ms 🟢 -1.35%
array_10000/ (B/op) 9.89 MB 9.89 MB ⚪ 0%
array_10000/ (allocs/op) 120,736 allocs 120,737 allocs ⚪ 0%
array_gc_100/ (ns/op) 138092.00 ns 134004.00 ns 🟢 -2.96%
array_gc_100/ (B/op) 99.93 KB 99.93 KB ⚪ 0%
array_gc_100/ (allocs/op) 1,267 allocs 1,267 allocs ⚪ 0%
array_gc_1000/ (ns/op) 1.48 ms 1.43 ms 🟢 -3.21%
array_gc_1000/ (B/op) 1.14 MB 1.14 MB ⚪ 0%
array_gc_1000/ (allocs/op) 12,927 allocs 12,927 allocs ⚪ 0%
counter_1000/ (ns/op) 213454.00 ns 206058.00 ns 🟢 -3.46%
counter_1000/ (B/op) 178.18 KB 178.18 KB ⚪ 0%
counter_1000/ (allocs/op) 5,772 allocs 5,772 allocs ⚪ 0%
counter_10000/ (ns/op) 2.23 ms 2.18 ms 🟢 -2.22%
counter_10000/ (B/op) 2.07 MB 2.07 MB ⚪ 0%
counter_10000/ (allocs/op) 59,779 allocs 59,779 allocs ⚪ 0%
object_1000/ (ns/op) 1.48 ms 1.44 ms 🟢 -2.71%
object_1000/ (B/op) 1.44 MB 1.44 MB 🟢 -0.02%
object_1000/ (allocs/op) 9,926 allocs 9,926 allocs ⚪ 0%
object_10000/ (ns/op) 15.34 ms 14.57 ms 🟢 -5.04%
object_10000/ (B/op) 12.35 MB 12.35 MB 🟢 -0.02%
object_10000/ (allocs/op) 101,234 allocs 101,227 allocs ⚪ 0%
tree_100/ (ns/op) 1.11 ms 1.06 ms 🟢 -4.51%
tree_100/ (B/op) 951.08 KB 951.08 KB ⚪ 0%
tree_100/ (allocs/op) 6,103 allocs 6,103 allocs ⚪ 0%
tree_1000/ (ns/op) 81.61 ms 78.81 ms 🟢 -3.43%
tree_1000/ (B/op) 86.58 MB 86.58 MB ⚪ 0%
tree_1000/ (allocs/op) 60,112 allocs 60,113 allocs ⚪ 0%
tree_10000/ (ns/op) 9.93 s 9.60 s 🟢 -3.28%
tree_10000/ (B/op) 8.58 GB 8.58 GB ⚪ 0%
tree_10000/ (allocs/op) 600,184 allocs 600,215 allocs ⚪ 0%
tree_delete_all_1000/ (ns/op) 83.08 ms 78.89 ms 🟢 -5.04%
tree_delete_all_1000/ (B/op) 87.57 MB 87.57 MB ⚪ 0%
tree_delete_all_1000/ (allocs/op) 75,291 allocs 75,287 allocs ⚪ 0%
tree_edit_gc_100/ (ns/op) 4.08 ms 3.95 ms 🟢 -3.26%
tree_edit_gc_100/ (B/op) 4.15 MB 4.15 MB ⚪ 0%
tree_edit_gc_100/ (allocs/op) 15,147 allocs 15,148 allocs ⚪ 0%
tree_edit_gc_1000/ (ns/op) 341.83 ms 324.09 ms 🟢 -5.19%
tree_edit_gc_1000/ (B/op) 384.05 MB 384.04 MB ⚪ 0%
tree_edit_gc_1000/ (allocs/op) 154,962 allocs 154,949 allocs ⚪ 0%
tree_split_gc_100/ (ns/op) 2.81 ms 2.73 ms 🟢 -2.72%
tree_split_gc_100/ (B/op) 2.41 MB 2.41 MB ⚪ 0%
tree_split_gc_100/ (allocs/op) 11,132 allocs 11,132 allocs ⚪ 0%
tree_split_gc_1000/ (ns/op) 206.54 ms 198.78 ms 🟢 -3.76%
tree_split_gc_1000/ (B/op) 222.50 MB 222.50 MB ⚪ 0%
tree_split_gc_1000/ (allocs/op) 122,064 allocs 122,076 allocs ⚪ 0%
BenchmarkRPC
Benchmark suite Previous Current Change
client_to_server/ (ns/op) 431.30 ms 420.31 ms 🟢 -2.55%
client_to_server/ (B/op) 16.13 MB 16.12 MB 🟢 -0.07%
client_to_server/ (allocs/op) 223,579 allocs 223,525 allocs 🟢 -0.02%
client_to_client_via_server/ (ns/op) 534.17 ms 518.32 ms 🟢 -2.97%
client_to_client_via_server/ (B/op) 26.68 MB 27.80 MB 🔴 +4.22%
client_to_client_via_server/ (allocs/op) 330,511 allocs 330,611 allocs 🔴 +0.03%
attach_large_document/ (ns/op) 1.31 s 1.28 s 🟢 -2.02%
attach_large_document/ (B/op) 1.92 GB 1.92 GB 🟢 -0.09%
attach_large_document/ (allocs/op) 12,347 allocs 12,278 allocs 🟢 -0.56%
adminCli_to_server/ (ns/op) 546.76 ms 541.64 ms 🟢 -0.94%
adminCli_to_server/ (B/op) 21.71 MB 21.30 MB 🟢 -1.89%
adminCli_to_server/ (allocs/op) 316,680 allocs 316,684 allocs ⚪ 0%
BenchmarkLocker
Benchmark suite Previous Current Change
(ns/op) 83.48 ns 80.58 ns 🟢 -3.47%
(B/op) 32.00 B 32.00 B ⚪ 0%
(allocs/op) 1 allocs 1 allocs ⚪ 0%
BenchmarkLockerParallel
Benchmark suite Previous Current Change
(ns/op) 45.35 ns 45.08 ns 🟢 -0.60%
(B/op) 0.00 B 0.00 B ⚪ 0%
(allocs/op) 0 allocs 0 allocs ⚪ 0%
BenchmarkLockerMoreKeys
Benchmark suite Previous Current Change
(ns/op) 174.90 ns 182.70 ns 🔴 +4.46%
(B/op) 31.00 B 30.00 B 🟢 -3.23%
(allocs/op) 0 allocs 0 allocs ⚪ 0%
BenchmarkRWLocker
Benchmark suite Previous Current Change
RWLock_rate_2/ (ns/op) 50.01 ns 49.36 ns 🟢 -1.30%
RWLock_rate_2/ (B/op) 0.00 B 0.00 B ⚪ 0%
RWLock_rate_2/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
RWLock_rate_10/ (ns/op) 43.22 ns 43.62 ns 🔴 +0.93%
RWLock_rate_10/ (B/op) 0.00 B 0.00 B ⚪ 0%
RWLock_rate_10/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
RWLock_rate_100/ (ns/op) 59.21 ns 63.25 ns 🔴 +6.82%
RWLock_rate_100/ (B/op) 2.00 B 2.00 B ⚪ 0%
RWLock_rate_100/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
RWLock_rate_1000/ (ns/op) 87.90 ns 88.24 ns 🔴 +0.39%
RWLock_rate_1000/ (B/op) 8.00 B 8.00 B ⚪ 0%
RWLock_rate_1000/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
BenchmarkChange
Benchmark suite Previous Current Change
Push_10_Changes/ (ns/op) 4.47 ms 4.44 ms 🟢 -0.78%
Push_10_Changes/ (B/op) 150.30 KB 150.69 KB 🔴 +0.26%
Push_10_Changes/ (allocs/op) 1,618 allocs 1,624 allocs 🔴 +0.37%
Push_100_Changes/ (ns/op) 16.21 ms 16.42 ms 🔴 +1.34%
Push_100_Changes/ (B/op) 774.67 KB 784.36 KB 🔴 +1.25%
Push_100_Changes/ (allocs/op) 8,507 allocs 8,514 allocs 🔴 +0.08%
Push_1000_Changes/ (ns/op) 128.55 ms 133.51 ms 🔴 +3.86%
Push_1000_Changes/ (B/op) 7.31 MB 7.20 MB 🟢 -1.54%
Push_1000_Changes/ (allocs/op) 79,323 allocs 79,331 allocs 🔴 +0.01%
Pull_10_Changes/ (ns/op) 3.68 ms 3.69 ms 🔴 +0.11%
Pull_10_Changes/ (B/op) 124.52 KB 124.80 KB 🔴 +0.22%
Pull_10_Changes/ (allocs/op) 1,454 allocs 1,454 allocs ⚪ 0%
Pull_100_Changes/ (ns/op) 5.30 ms 5.29 ms 🟢 -0.08%
Pull_100_Changes/ (B/op) 354.81 KB 354.97 KB 🔴 +0.05%
Pull_100_Changes/ (allocs/op) 5,180 allocs 5,180 allocs ⚪ 0%
Pull_1000_Changes/ (ns/op) 10.80 ms 10.85 ms 🔴 +0.41%
Pull_1000_Changes/ (B/op) 2.20 MB 2.20 MB 🔴 +0.13%
Pull_1000_Changes/ (allocs/op) 44,680 allocs 44,681 allocs ⚪ 0%
BenchmarkSnapshot
Benchmark suite Previous Current Change
Push_3KB_snapshot/ (ns/op) 18.86 ms 18.77 ms 🟢 -0.45%
Push_3KB_snapshot/ (B/op) 890.17 KB 899.56 KB 🔴 +1.06%
Push_3KB_snapshot/ (allocs/op) 8,516 allocs 8,516 allocs ⚪ 0%
Push_30KB_snapshot/ (ns/op) 131.38 ms 136.79 ms 🔴 +4.12%
Push_30KB_snapshot/ (B/op) 8.01 MB 7.99 MB 🟢 -0.27%
Push_30KB_snapshot/ (allocs/op) 87,022 allocs 87,322 allocs 🔴 +0.34%
Pull_3KB_snapshot/ (ns/op) 7.32 ms 7.32 ms 🟢 -0.11%
Pull_3KB_snapshot/ (B/op) 1.06 MB 1.06 MB 🔴 +0.05%
Pull_3KB_snapshot/ (allocs/op) 19,259 allocs 19,260 allocs ⚪ 0%
Pull_30KB_snapshot/ (ns/op) 19.44 ms 18.88 ms 🟢 -2.90%
Pull_30KB_snapshot/ (B/op) 8.77 MB 8.77 MB 🔴 +0.11%
Pull_30KB_snapshot/ (allocs/op) 185,673 allocs 185,675 allocs ⚪ 0%
BenchmarkSplayTree
Benchmark suite Previous Current Change
stress_test_100000/ (ns/op) 0.19 ns 0.20 ns 🔴 +4.34%
stress_test_100000/ (B/op) 0.00 B 0.00 B ⚪ 0%
stress_test_100000/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
stress_test_200000/ (ns/op) 0.38 ns 0.39 ns 🔴 +1.68%
stress_test_200000/ (B/op) 0.00 B 0.00 B ⚪ 0%
stress_test_200000/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
stress_test_300000/ (ns/op) 0.61 ns 0.58 ns 🟢 -4.54%
stress_test_300000/ (B/op) 0.00 B 0.00 B ⚪ 0%
stress_test_300000/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
random_access_100000/ (ns/op) 0.01 ns 0.01 ns 🟢 -1.89%
random_access_100000/ (B/op) 0.00 B 0.00 B ⚪ 0%
random_access_100000/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
random_access_200000/ (ns/op) 0.03 ns 0.03 ns 🟢 -6.53%
random_access_200000/ (B/op) 0.00 B 0.00 B ⚪ 0%
random_access_200000/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
random_access_300000/ (ns/op) 0.04 ns 0.04 ns 🟢 -2.54%
random_access_300000/ (B/op) 0.00 B 0.00 B ⚪ 0%
random_access_300000/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
editing_trace_bench/ (ns/op) 0.00 ns 0.00 ns 🟢 -13.59%
editing_trace_bench/ (B/op) 0.00 B 0.00 B ⚪ 0%
editing_trace_bench/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
BenchmarkSync
Benchmark suite Previous Current Change
memory_sync_10_test/ (ns/op) 7278.00 ns 7153.00 ns 🟢 -1.72%
memory_sync_10_test/ (B/op) 1.34 KB 1.34 KB ⚪ 0%
memory_sync_10_test/ (allocs/op) 35 allocs 35 allocs ⚪ 0%
memory_sync_100_test/ (ns/op) 55524.00 ns 55187.00 ns 🟢 -0.61%
memory_sync_100_test/ (B/op) 9.51 KB 9.52 KB 🔴 +0.09%
memory_sync_100_test/ (allocs/op) 268 allocs 268 allocs ⚪ 0%
memory_sync_1000_test/ (ns/op) 607648.00 ns 621004.00 ns 🔴 +2.20%
memory_sync_1000_test/ (B/op) 76.60 KB 75.98 KB 🟢 -0.81%
memory_sync_1000_test/ (allocs/op) 2,133 allocs 2,111 allocs 🟢 -1.03%
memory_sync_10000_test/ (ns/op) 7.87 ms 7.69 ms 🟢 -2.24%
memory_sync_10000_test/ (B/op) 753.72 KB 761.08 KB 🔴 +0.98%
memory_sync_10000_test/ (allocs/op) 20,438 allocs 20,526 allocs 🔴 +0.43%
BenchmarkTextEditing
Benchmark suite Previous Current Change
(ns/op) 5.32 s 5.24 s 🟢 -1.47%
(B/op) 3.92 GB 3.92 GB ⚪ 0%
(allocs/op) 20,619,803 allocs 20,619,960 allocs ⚪ 0%
BenchmarkTree
Benchmark suite Previous Current Change
10000_vertices_to_protobuf/ (ns/op) 4.52 ms 4.40 ms 🟢 -2.55%
10000_vertices_to_protobuf/ (B/op) 6.36 MB 6.36 MB ⚪ 0%
10000_vertices_to_protobuf/ (allocs/op) 70,025 allocs 70,025 allocs ⚪ 0%
10000_vertices_from_protobuf/ (ns/op) 228.67 ms 224.31 ms 🟢 -1.91%
10000_vertices_from_protobuf/ (B/op) 442.30 MB 442.31 MB ⚪ 0%
10000_vertices_from_protobuf/ (allocs/op) 290,039 allocs 290,047 allocs ⚪ 0%
20000_vertices_to_protobuf/ (ns/op) 9.47 ms 9.07 ms 🟢 -4.25%
20000_vertices_to_protobuf/ (B/op) 12.89 MB 12.89 MB ⚪ 0%
20000_vertices_to_protobuf/ (allocs/op) 140,028 allocs 140,029 allocs ⚪ 0%
20000_vertices_from_protobuf/ (ns/op) 878.69 ms 868.63 ms 🟢 -1.15%
20000_vertices_from_protobuf/ (B/op) 1.70 GB 1.70 GB ⚪ 0%
20000_vertices_from_protobuf/ (allocs/op) 580,090 allocs 580,082 allocs ⚪ 0%
30000_vertices_to_protobuf/ (ns/op) 13.65 ms 13.73 ms 🔴 +0.54%
30000_vertices_to_protobuf/ (B/op) 18.98 MB 18.98 MB ⚪ 0%
30000_vertices_to_protobuf/ (allocs/op) 210,029 allocs 210,029 allocs ⚪ 0%
30000_vertices_from_protobuf/ (ns/op) 2.09 s 1.99 s 🟢 -4.57%
30000_vertices_from_protobuf/ (B/op) 3.75 GB 3.75 GB ⚪ 0%
30000_vertices_from_protobuf/ (allocs/op) 870,147 allocs 870,222 allocs ⚪ 0%
BenchmarkVersionVector
Benchmark suite Previous Current Change
clients_10/ (ns/op) 159.13 ms 160.28 ms 🔴 +0.72%
clients_10/ (1_changepack(bytes)) 745.00 B 745.00 B ⚪ 0%
clients_10/ (2_snapshot(bytes)) 379.00 B 379.00 B ⚪ 0%
clients_10/ (3_pushpull(ms)) 8.00 ms 8.00 ms ⚪ 0%
clients_10/ (4_attach(ms)) 6.00 ms 6.00 ms ⚪ 0%
clients_10/ (5_changepack_after_detach(bytes)) 805.00 B 805.00 B ⚪ 0%
clients_10/ (6_snapshot_after_detach(bytes)) 136.00 B 136.00 B ⚪ 0%
clients_10/ (7_pushpull_after_detach(ms)) 8.00 ms 8.00 ms ⚪ 0%
clients_10/ (B/op) 20.01 MB 20.26 MB 🔴 +1.27%
clients_10/ (allocs/op) 83,228 allocs 83,249 allocs 🔴 +0.03%
clients_100/ (ns/op) 1.40 s 1.41 s 🔴 +0.65%
clients_100/ (1_changepack(bytes)) 6.14 KB 6.14 KB ⚪ 0%
clients_100/ (2_snapshot(bytes)) 3.08 KB 3.08 KB ⚪ 0%
clients_100/ (3_pushpull(ms)) 11.00 ms 11.00 ms ⚪ 0%
clients_100/ (4_attach(ms)) 9.00 ms 9.00 ms ⚪ 0%
clients_100/ (5_changepack_after_detach(bytes)) 6.21 KB 6.21 KB ⚪ 0%
clients_100/ (6_snapshot_after_detach(bytes)) 137.00 B 137.00 B ⚪ 0%
clients_100/ (7_pushpull_after_detach(ms)) 9.00 ms 9.00 ms ⚪ 0%
clients_100/ (B/op) 215.15 MB 213.55 MB 🟢 -0.74%
clients_100/ (allocs/op) 1,481,377 allocs 1,481,479 allocs ⚪ 0%
clients_1000/ (ns/op) 42.81 s 43.18 s 🔴 +0.88%
clients_1000/ (1_changepack(bytes)) 60.16 KB 60.16 KB ⚪ 0%
clients_1000/ (2_snapshot(bytes)) 30.08 KB 30.08 KB ⚪ 0%
clients_1000/ (3_pushpull(ms)) 114.00 ms 121.00 ms 🔴 +6.14%
clients_1000/ (4_attach(ms)) 72.00 ms 72.00 ms ⚪ 0%
clients_1000/ (5_changepack_after_detach(bytes)) 60.22 KB 60.22 KB ⚪ 0%
clients_1000/ (6_snapshot_after_detach(bytes)) 139.00 B 139.00 B ⚪ 0%
clients_1000/ (7_pushpull_after_detach(ms)) 22.00 ms 22.00 ms ⚪ 0%
clients_1000/ (B/op) 6.43 GB 6.44 GB 🔴 +0.02%
clients_1000/ (allocs/op) 93,355,010 allocs 93,357,108 allocs ⚪ 0%

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🔭 Outside diff range comments (2)
client/client.go (1)

619-621: ⚠️ Potential issue

Remove duplicate error return statement.

There's a duplicate return nil, err statement which should be removed.

if err != nil {
    return nil, err
-    return nil, err
}
pkg/limit/limiter.go (1)

168-180: ⚠️ Potential issue

Redefinition of Close().

This second definition overlaps with lines 153–156. Remove or unify them into one method.

🧹 Nitpick comments (9)
build/build-binaries.sh (1)

25-27: Add ARM64 Support for macOS
The new conditional correctly checks if GOOS is "darwin" and appends "arm64" to the TARGET_ARCHS array, thereby enabling ARM64 builds on macOS. This meets the intended functionality as described in the PR objectives.

A minor improvement: consider using Bash’s [[ ... ]] for string comparisons instead of [ ... ] for enhanced robustness and readability. For example:

-    if [ "${GOOS}" == "darwin" ]; then
+    if [[ "${GOOS}" == "darwin" ]]; then
.golangci.yml (2)

26-27: Review: Gosec Exclusions Updated

The configuration now explicitly excludes both G107 and G115. The addition of G115 (to ignore integer overflow warnings) can help reduce false positives, but please verify that suppressing these warnings does not hide potential overflow vulnerabilities in critical components. It would be beneficial to document the rationale for excluding G115 so future maintainers can quickly understand the decision.


29-31: Review: Disabled "unused-parameter" Rule in Revive

The new Revive settings disable the unused-parameter rule. This change is useful for cases where unused parameters are intentional (e.g., in interface implementations or callback signatures). Ensure that this exception is well justified in your project’s coding guidelines or documentation to avoid potential oversight of genuinely unused parameters.

CHANGELOG.md (1)

14-16: Bare URL Formatting in Changelog
Several changelog entries include bare URLs (e.g., https://github.com/yorkie-team/yorkie/pull/1156). To adhere to markdown linting best practices (MD034), consider wrapping these URLs in markdown link syntax. For example:

- - Add Event Webhook Support with DocRootChanged Event by @window9u in https://github.com/yorkie-team/yorkie/pull/1156
+ - Add Event Webhook Support with DocRootChanged Event by @window9u in [#1156](https://github.com/yorkie-team/yorkie/pull/1156)

This change will improve consistency and readability in the changelog.

🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

14-14: Bare URL used
null

(MD034, no-bare-urls)


15-15: Bare URL used
null

(MD034, no-bare-urls)


16-16: Bare URL used
null

(MD034, no-bare-urls)

pkg/limit/limiter_test.go (2)

41-41: Test iteration count reduced to 1000.

Reducing from 10000 to 1000 speeds up tests, but consider verifying stress scenarios remain covered.


141-141: Reduced throttle windows from 10 to 3.

Confirm that test coverage is still sufficient to exercise multi-window behavior.

server/backend/pubsub/publisher.go (1)

129-129: Minor docstring tweak.

“batch batchPublisher” is slightly repetitive. Consider removing duplicate wording for clarity.

-// Close stops the batch batchPublisher
+// Close stops the batch publisher
pkg/limit/limiter.go (2)

42-48: Constructor signature updated for three time-based parameters.

If you need an example usage snippet or doc clarifying how to select each duration, let us know. We can open a separate doc PR.


63-69: Renamed limitEntrylimiterEntry with debouncingCallback returning error.

If callbacks can fail, consider logging or surfacing these errors up the call chain.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 01f655e and 73b6c25.

📒 Files selected for processing (40)
  • pkg/limit/limiter.go (1 hunks)
  • pkg/limit/limiter_test.go (7 hunks)
  • pkg/limit/limiter.go (2 hunks)
  • pkg/limit/limiter.go (1 hunks)
  • pkg/limit/limiter_test.go (0 hunks)
  • server/backend/pubsub/publisher.go (3 hunks)
  • client/client.go (4 hunks)
  • .golangci.yml (0 hunks)
  • client/client.go (3 hunks)
  • pkg/limit/limiter.go (1 hunks)
  • pkg/limit/limiter_test.go (1 hunks)
  • server/backend/pubsub/publisher.go (4 hunks)
  • pkg/limit/limiter.go (1 hunks)
  • pkg/limit/limiter_test.go (0 hunks)
  • pkg/limit/limiter.go (1 hunks)
  • pkg/limit/limiter.go (2 hunks)
  • pkg/limit/limiter.go (3 hunks)
  • pkg/limit/limiter.go (3 hunks)
  • pkg/limit/limiter.go (4 hunks)
  • pkg/limit/limiter_test.go (1 hunks)
  • pkg/limit/limiter.go (3 hunks)
  • pkg/limit/limiter_test.go (7 hunks)
  • pkg/limit/limiter.go (3 hunks)
  • pkg/limit/limiter_test.go (8 hunks)
  • pkg/limit/limiter_test.go (1 hunks)
  • .golangci.yml (1 hunks)
  • CHANGELOG.md (1 hunks)
  • Makefile (2 hunks)
  • api/docs/yorkie.base.yaml (1 hunks)
  • api/docs/yorkie/v1/admin.openapi.yaml (58 hunks)
  • api/docs/yorkie/v1/cluster.openapi.yaml (7 hunks)
  • api/docs/yorkie/v1/resources.openapi.yaml (67 hunks)
  • api/docs/yorkie/v1/yorkie.openapi.yaml (52 hunks)
  • build/build-binaries.sh (1 hunks)
  • build/charts/yorkie-analytics/Chart.yaml (1 hunks)
  • build/charts/yorkie-cluster/Chart.yaml (1 hunks)
  • client/client.go (2 hunks)
  • server/backend/pubsub/publisher.go (4 hunks)
  • pkg/limit/limiter.go (3 hunks)
  • pkg/limit/limiter_test.go (9 hunks)
✅ Files skipped from review due to trivial changes (9)
  • pkg/limit/limiter_test.go
  • api/docs/yorkie.base.yaml
  • build/charts/yorkie-cluster/Chart.yaml
  • build/charts/yorkie-analytics/Chart.yaml
  • client/client.go
  • api/docs/yorkie/v1/yorkie.openapi.yaml
  • pkg/limit/limiter_test.go
  • api/docs/yorkie/v1/admin.openapi.yaml
  • api/docs/yorkie/v1/resources.openapi.yaml
🚧 Files skipped from review as they are similar to previous changes (7)
  • pkg/limit/limiter.go
  • pkg/limit/limiter.go
  • pkg/limit/limiter_test.go
  • pkg/limit/limiter.go
  • pkg/limit/limiter_test.go
  • pkg/limit/limiter.go
  • pkg/limit/limiter.go
🧰 Additional context used
🧠 Learnings (1)
pkg/limit/limiter.go (1)
Learnt from: window9u
PR: yorkie-team/yorkie#1166
File: pkg/limit/limiter.go:132-132
Timestamp: 2025-03-07T10:41:57.466Z
Learning: Go 1.23, released in August 2024, added support for `for range` loops with integers. However, the project currently uses Go 1.21, which does not support this syntax.
🪛 markdownlint-cli2 (0.17.2)
CHANGELOG.md

14-14: Bare URL used
null

(MD034, no-bare-urls)


15-15: Bare URL used
null

(MD034, no-bare-urls)


16-16: Bare URL used
null

(MD034, no-bare-urls)


20-20: Bare URL used
null

(MD034, no-bare-urls)


21-21: Bare URL used
null

(MD034, no-bare-urls)


22-22: Bare URL used
null

(MD034, no-bare-urls)


23-23: Bare URL used
null

(MD034, no-bare-urls)


27-27: Bare URL used
null

(MD034, no-bare-urls)

⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: build
  • GitHub Check: bench
🔇 Additional comments (42)
client/client.go (4)

513-513: Function signature update correctly implemented.

The update to pass c.id to the handleResponse function ensures that client can identify and handle its own messages appropriately.


526-527: Function signature update correctly implemented.

The update to pass c.id to the handleResponse function in the stream handling loop ensures consistent behavior with the initialization call.


597-598: Function signature updated to match the PR objectives.

The added parameter allows the function to filter out messages from the same client, which supports the throttling and debouncing mechanism described in the PR objectives.


623-626: Self-message filtering correctly implemented.

This new check properly implements filtering of messages from the same client that initiated the action. This helps prevent feedback loops in the event system and supports the debouncing mechanism mentioned in the PR objectives.

api/docs/yorkie/v1/cluster.openapi.yaml (15)

3-7: Info Block & Version Update

The version has been updated to v0.6.1, and the description block is formatted consistently. Please ensure that any clients or integrations referring to this API version are updated accordingly.


9-12: Server Definitions Formatting

The servers section now uses a clear list format with distinct entries for the production and local servers. This improves readability and consistency. Verify that the provided URLs are accurate for your deployment environments.


18-23: $ref References Consistency for Endpoints

The $ref entries for the request body and responses have been updated to use double quotes consistently. This change aligns with YAML best practices and improves the overall consistency of the document.


25-25: Endpoint Tag Update

The tag is now listed in a YAML list format. This update, while minor, enhances uniformity across the spec.


32-35: Request Body Schema References

The $ref values in the requestBody components are now enclosed in double quotes, ensuring uniformity across the spec. No functional changes, but the styling helps maintain clarity.


38-46: Response Schema References Update

The response schemas now use consistently quoted $ref entries. This not only adheres to YAML style guidelines but also minimizes potential parsing ambiguities.


47-55: Additional Response Reference Consistency

The $ref for the DetachDocument response is also updated with double quotes. Ensuring that these changes are applied uniformly across all endpoints enhances document consistency.


57-77: Connect Error Schema Standardization

The "connect.error" schema now features a double-quoted description and improved indentation for enumerated values. This refinement improves readability and ensures that clients can reliably parse error codes.


189-196: Request Schema References in DetachDocument Request

Both the documentSummary and project properties now consistently reference their schemas with double quotes. This update aids in maintaining uniform and clear schema definitions.


212-219: Timestamp Schema Integration in DocumentSummary

The accessedAt and createdAt properties in the DocumentSummary schema now properly reference google.protobuf.Timestamp using updated formatting. This ensures that timestamp data are standardized across the API.


239-243: Updated Timestamp Reference for DocumentSummary

The updatedAt property is now also using the google.protobuf.Timestamp reference consistently. It is important that all timestamp fields remain uniform for reliable data interchange.


268-273: Project Schema – createdAt Timestamp Update

The createdAt property of the Project schema now leverages the google.protobuf.Timestamp reference with the standardized formatting. This is consistent with the handling of timestamp fields throughout the spec.


306-310: Project Schema – updatedAt Timestamp Update

Similarly, the updatedAt property in the Project schema now references google.protobuf.Timestamp correctly. Uniform timestamp references help ensure that date-time information is processed consistently.


319-319: Security Object Format

The security section now correctly lists the ApiKeyAuth scheme in a list format. This change adheres to recommended OpenAPI practices.


321-322: Tag Definition Enhancement

The tag for yorkie.v1.ClusterService now includes a descriptive field. This improvement provides better context for API users and aligns with the rest of the document’s standardized tag formatting.

Makefile (2)

1-1: Version Bump Confirmation in Makefile
The version variable has been updated to 0.6.1, which aligns with the other changes in this release. Please ensure that all related documentation and release notes are synchronized with this new version.


26-26: Updated golangci-lint Installation Command
The install command for golangci-lint has been updated to use version v1.64.6. Verify that this version is compatible with our linting rules and does not introduce new lint errors or unexpected behavior in the CI process.

CHANGELOG.md (3)

18-24: Documenting Change and Improvement Details
The "Changed" section lists improvements (e.g., optimizing VersionVector efficiency, replacing gRPC with ConnectRPC, updating in-place comparisons, and preventing duplicate events). These entries are clear, but ensure that they are cross-validated with the updated backend logic.

🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

20-20: Bare URL used
null

(MD034, no-bare-urls)


21-21: Bare URL used
null

(MD034, no-bare-urls)


22-22: Bare URL used
null

(MD034, no-bare-urls)


23-23: Bare URL used
null

(MD034, no-bare-urls)


25-28: Fixed Section Review
The "Fixed" section correctly documents the storage of benchmark results in a dedicated CI branch. Please double-check that any tests covering these fixes have been appropriately updated in the codebase.

🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

27-27: Bare URL used
null

(MD034, no-bare-urls)


10-17:

Details

❓ Verification inconclusive

New Changelog Entry for Version 0.6.1
A new entry for version 0.6.1 has been added with sections for "Added". It currently includes the addition of Event Webhook Support (DocRootChanged Event), a new Helm chart, and benchmark enhancements. The PR objectives mention an Event Timing Control Package with throttling and debouncing; if that functionality is part of this PR, please consider adding a dedicated bullet to document those changes.


Action: Verify and update changelog for event timing control documentation

The new changelog entry for version 0.6.1 currently documents the addition of Event Webhook Support, a new Helm chart, and benchmark improvements. However, the PR objectives mention an Event Timing Control Package with throttling and debouncing. If that functionality is part of this PR, please add a dedicated bullet point under the "Added" section to document these changes.

  • File: CHANGELOG.md (lines 10–17)
  • Add a bullet for Event Timing Control Package features if applicable
🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

14-14: Bare URL used
null

(MD034, no-bare-urls)


15-15: Bare URL used
null

(MD034, no-bare-urls)


16-16: Bare URL used
null

(MD034, no-bare-urls)

pkg/limit/limiter_test.go (9)

23-23: No concerns with the added import.


83-83: Parameter adjustment for expireBatchSize.

Decreasing it to 100 likely makes the test more responsive for batch expiration checks.


88-88: Replicating iteration count reduction to 1000.

This aids faster concurrency tests while still validating functionality.


99-99: Local WaitGroup usage introduced.

Helps properly synchronize concurrent goroutines in tests.


101-103: Ensure defer is inside the goroutine.

The placement of wg.Done() looks correct for concurrency.


143-145: Event & concurrency settings expanded.

Increasing events per window and concurrent calls can yield more realistic stress testing.


217-218: Another for range integer usage.

Same note about Go version requirements. Please confirm you are on Go ≥1.23 to avoid compilation errors.


246-257: Graceful close logic introduced.

The forced close mechanism with a timeout check ensures any pending callbacks finish properly. Good addition.


67-71:

Details

✅ Verification successful

Potential Go version compatibility issue with for range on integers.

If your project truly uses Go ≥1.23, this syntax is valid. Otherwise, it will not compile.
You can verify by running the following script to check your go.mod:


🏁 Script executed:

#!/bin/bash
rg '^go ' go.mod

Length of output: 26


Go Version Verified – No Compatibility Issue

The project uses Go 1.23 as confirmed by go.mod, so the for range syntax on integers is valid, and no changes are necessary.

server/backend/pubsub/publisher.go (3)

21-21: Added context and time imports.

No issues. These imports are reasonable for async tasks and scheduling.

Also applies to: 25-25


30-30: Introduced usage of rate-limiting package.

Helps integrate the new throttling and debouncing logic into publishers.


134-175: New LimitPublisher implementation.

  • Introduces a separate publisher with integrated rate-limiter.
  • The constructor initializes limiters for each event type, then the Publish method defers the execution to limit.Limiter.Execute().
  • The approach effectively throttles and debounces event publication.

Recommend verifying concurrency in higher-level integration tests to ensure no race conditions.

pkg/limit/limiter.go (6)

17-17: Updated package documentation.

Reflects new debouncing capability. Clear and concise.


26-40: Enhanced Limiter struct with rateWindow and entryTTL fields.

Improves clarity by distinguishing the expiration interval from the rate-limiting window.


71-103: Revised Allow method to handle debouncing logic.

Verify that re-allowing sets debouncingCallback = nil only if the bucket permits. Otherwise, the callback is queued. This is presumably correct, but might be worth a deeper test if partial concurrency concerns exist.


105-118: expirationLoop introduced with ticker-based expiration checks.

Periodic expiration approach is straightforward. Good that it stops on closeChan.


120-151: expireEntries extension to handle debouncing callbacks.

The approach of collecting expired entries, then invoking their callbacks outside the lock, helps avoid blocking the main mutex. Nice design.


157-166:

Details

❌ Incorrect review comment

runDebounce function references l.wg, which is not declared above.

Confirm that a sync.WaitGroup field exists in Limiter and is properly initialized. Otherwise, this will not compile.
Please run:

to confirm there's a wg field.


🏁 Script executed:

#!/bin/bash
rg 'wg\s+sync\.WaitGroup' pkg/limit/limiter.go

Length of output: 72


Verified: The sync.WaitGroup field (wg) is declared properly in the Limiter struct in pkg/limit/limiter.go. No changes to the runDebounce function are necessary. Please disregard the original comment regarding the missing declaration.

Likely an incorrect or invalid review comment.

Comment thread pkg/limit/limiter.go
Comment on lines +153 to +156

return expiredEntries
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue

Potential duplicated Close definition starts here (lines 153-156).

The file later has lines 168–180, which also define func (l *Limiter[K]) Close(). This duplication likely breaks compilation. Merge them into a single method.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
pkg/limit/limiter_test.go (1)

60-360: Consider replacing time.Sleep with more deterministic checks.
Using time.Sleep in tests can cause flakiness, especially on slower or heavily loaded machines. Where possible, consider using channels, condition variables, or a custom clock for more reliable test synchronization.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 73b6c25 and 261ef28.

📒 Files selected for processing (1)
  • pkg/limit/limiter_test.go (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: bench
  • GitHub Check: build
🔇 Additional comments (2)
pkg/limit/limiter_test.go (2)

1-15: License header and initial setup look good.
No concerns here.


32-36: Struct design supports concurrency properly.
The use of a sync.Mutex for the shared slice is appropriate.

Comment thread pkg/limit/limiter_test.go

@hackerwins-yorkie hackerwins-yorkie left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Go Benchmark Analysis 📊

This is a comparison result between the previous(68c233b) and the current commit(0495f65).

Significant Changes (≥20% difference)

Benchmark suite Previous Current Change
BenchmarkSplayTree/editing_trace_bench/ (ns/op) 0.00 ns 0.00 ns 🟢 -30.91%

Key Observations 🔍

  • In the benchmark suite BenchmarkSplayTree, the test stress_test_300000 showed a significant decrease in performance with a change of 🟢 -4.72% in ns/op. This indicates an improvement in the efficiency of handling stress tests with 300,000 operations.
  • Overall, there were several benchmark tests across different suites that showed varying degrees of improvement or deterioration in performance, ranging from 🟢 -9.53% to 🔴 +6.52%. These changes highlight the dynamic nature of the system's performance across different scenarios.
  • The benchmark suite BenchmarkRPC demonstrated consistent improvements in various tests, such as client_to_server and client_to_client_via_server, with notable reductions in ns/op and B/op. This suggests enhanced efficiency in client-server communication and inter-client communication scenarios.

Detailed Test Results

BenchmarkDocument
Benchmark suite Previous Current Change
constructor_test/ (ns/op) 1475.00 ns 1476.00 ns 🔴 +0.07%
constructor_test/ (B/op) 1.43 KB 1.43 KB ⚪ 0%
constructor_test/ (allocs/op) 25 allocs 25 allocs ⚪ 0%
status_test/ (ns/op) 1070.00 ns 1080.00 ns 🔴 +0.93%
status_test/ (B/op) 1.40 KB 1.40 KB ⚪ 0%
status_test/ (allocs/op) 23 allocs 23 allocs ⚪ 0%
equals_test/ (ns/op) 7923.00 ns 7983.00 ns 🔴 +0.76%
equals_test/ (B/op) 7.71 KB 7.71 KB ⚪ 0%
equals_test/ (allocs/op) 132 allocs 132 allocs ⚪ 0%
nested_update_test/ (ns/op) 16818.00 ns 19182.00 ns 🔴 +14.06%
nested_update_test/ (B/op) 12.36 KB 12.35 KB ⚪ 0%
nested_update_test/ (allocs/op) 259 allocs 259 allocs ⚪ 0%
delete_test/ (ns/op) 22897.00 ns 23228.00 ns 🔴 +1.45%
delete_test/ (B/op) 15.84 KB 15.84 KB ⚪ 0%
delete_test/ (allocs/op) 340 allocs 340 allocs ⚪ 0%
object_test/ (ns/op) 8584.00 ns 8633.00 ns 🔴 +0.57%
object_test/ (B/op) 7.08 KB 7.08 KB ⚪ 0%
object_test/ (allocs/op) 119 allocs 119 allocs ⚪ 0%
array_test/ (ns/op) 30978.00 ns 28381.00 ns 🟢 -8.38%
array_test/ (B/op) 12.19 KB 12.19 KB ⚪ 0%
array_test/ (allocs/op) 274 allocs 274 allocs ⚪ 0%
text_test/ (ns/op) 31716.00 ns 31675.00 ns 🟢 -0.13%
text_test/ (B/op) 15.24 KB 15.24 KB ⚪ 0%
text_test/ (allocs/op) 485 allocs 485 allocs ⚪ 0%
text_composition_test/ (ns/op) 31494.00 ns 31591.00 ns 🔴 +0.31%
text_composition_test/ (B/op) 18.75 KB 18.75 KB ⚪ 0%
text_composition_test/ (allocs/op) 502 allocs 502 allocs ⚪ 0%
rich_text_test/ (ns/op) 86630.00 ns 85474.00 ns 🟢 -1.33%
rich_text_test/ (B/op) 39.40 KB 39.40 KB ⚪ 0%
rich_text_test/ (allocs/op) 1,147 allocs 1,147 allocs ⚪ 0%
counter_test/ (ns/op) 18162.00 ns 18346.00 ns 🔴 +1.01%
counter_test/ (B/op) 11.86 KB 11.86 KB ⚪ 0%
counter_test/ (allocs/op) 254 allocs 254 allocs ⚪ 0%
text_edit_gc_100/ (ns/op) 1.38 ms 1.40 ms 🔴 +1.37%
text_edit_gc_100/ (B/op) 864.94 KB 864.93 KB ⚪ 0%
text_edit_gc_100/ (allocs/op) 17,282 allocs 17,283 allocs ⚪ 0%
text_edit_gc_1000/ (ns/op) 52.60 ms 52.81 ms 🔴 +0.38%
text_edit_gc_1000/ (B/op) 46.84 MB 46.84 MB ⚪ 0%
text_edit_gc_1000/ (allocs/op) 185,598 allocs 185,602 allocs ⚪ 0%
text_split_gc_100/ (ns/op) 2.10 ms 2.11 ms 🔴 +0.36%
text_split_gc_100/ (B/op) 1.58 MB 1.58 MB ⚪ 0%
text_split_gc_100/ (allocs/op) 15,951 allocs 15,952 allocs ⚪ 0%
text_split_gc_1000/ (ns/op) 127.99 ms 128.10 ms 🔴 +0.08%
text_split_gc_1000/ (B/op) 137.79 MB 137.79 MB ⚪ 0%
text_split_gc_1000/ (allocs/op) 184,982 allocs 185,005 allocs 🔴 +0.01%
text_delete_all_10000/ (ns/op) 17.22 ms 16.46 ms 🟢 -4.38%
text_delete_all_10000/ (B/op) 10.58 MB 10.58 MB ⚪ 0%
text_delete_all_10000/ (allocs/op) 56,134 allocs 56,136 allocs ⚪ 0%
text_delete_all_100000/ (ns/op) 299.69 ms 271.12 ms 🟢 -9.53%
text_delete_all_100000/ (B/op) 105.53 MB 105.53 MB ⚪ 0%
text_delete_all_100000/ (allocs/op) 566,117 allocs 566,106 allocs ⚪ 0%
text_100/ (ns/op) 246721.00 ns 234770.00 ns 🟢 -4.84%
text_100/ (B/op) 120.95 KB 120.95 KB ⚪ 0%
text_100/ (allocs/op) 5,182 allocs 5,182 allocs ⚪ 0%
text_1000/ (ns/op) 2.56 ms 2.49 ms 🟢 -2.53%
text_1000/ (B/op) 1.16 MB 1.16 MB 🔴 +0.03%
text_1000/ (allocs/op) 51,085 allocs 51,085 allocs ⚪ 0%
array_1000/ (ns/op) 1.31 ms 1.25 ms 🟢 -4.74%
array_1000/ (B/op) 1.09 MB 1.09 MB ⚪ 0%
array_1000/ (allocs/op) 11,880 allocs 11,880 allocs ⚪ 0%
array_10000/ (ns/op) 13.65 ms 13.27 ms 🟢 -2.81%
array_10000/ (B/op) 9.89 MB 9.89 MB 🟢 -0.01%
array_10000/ (allocs/op) 120,736 allocs 120,732 allocs ⚪ 0%
array_gc_100/ (ns/op) 138092.00 ns 135044.00 ns 🟢 -2.21%
array_gc_100/ (B/op) 99.93 KB 99.93 KB ⚪ 0%
array_gc_100/ (allocs/op) 1,267 allocs 1,267 allocs ⚪ 0%
array_gc_1000/ (ns/op) 1.48 ms 1.44 ms 🟢 -2.97%
array_gc_1000/ (B/op) 1.14 MB 1.14 MB ⚪ 0%
array_gc_1000/ (allocs/op) 12,927 allocs 12,927 allocs ⚪ 0%
counter_1000/ (ns/op) 213454.00 ns 206830.00 ns 🟢 -3.10%
counter_1000/ (B/op) 178.18 KB 178.19 KB ⚪ 0%
counter_1000/ (allocs/op) 5,772 allocs 5,772 allocs ⚪ 0%
counter_10000/ (ns/op) 2.23 ms 2.24 ms 🔴 +0.48%
counter_10000/ (B/op) 2.07 MB 2.07 MB ⚪ 0%
counter_10000/ (allocs/op) 59,779 allocs 59,779 allocs ⚪ 0%
object_1000/ (ns/op) 1.48 ms 1.44 ms 🟢 -2.53%
object_1000/ (B/op) 1.44 MB 1.44 MB 🟢 -0.03%
object_1000/ (allocs/op) 9,926 allocs 9,925 allocs 🟢 -0.01%
object_10000/ (ns/op) 15.34 ms 14.38 ms 🟢 -6.25%
object_10000/ (B/op) 12.35 MB 12.35 MB ⚪ 0%
object_10000/ (allocs/op) 101,234 allocs 101,232 allocs ⚪ 0%
tree_100/ (ns/op) 1.11 ms 1.10 ms 🟢 -1.29%
tree_100/ (B/op) 951.08 KB 951.07 KB ⚪ 0%
tree_100/ (allocs/op) 6,103 allocs 6,103 allocs ⚪ 0%
tree_1000/ (ns/op) 81.61 ms 79.23 ms 🟢 -2.92%
tree_1000/ (B/op) 86.58 MB 86.58 MB ⚪ 0%
tree_1000/ (allocs/op) 60,112 allocs 60,113 allocs ⚪ 0%
tree_10000/ (ns/op) 9.93 s 9.49 s 🟢 -4.42%
tree_10000/ (B/op) 8.58 GB 8.58 GB ⚪ 0%
tree_10000/ (allocs/op) 600,184 allocs 600,203 allocs ⚪ 0%
tree_delete_all_1000/ (ns/op) 83.08 ms 78.98 ms 🟢 -4.93%
tree_delete_all_1000/ (B/op) 87.57 MB 87.57 MB ⚪ 0%
tree_delete_all_1000/ (allocs/op) 75,291 allocs 75,290 allocs ⚪ 0%
tree_edit_gc_100/ (ns/op) 4.08 ms 3.88 ms 🟢 -4.92%
tree_edit_gc_100/ (B/op) 4.15 MB 4.15 MB ⚪ 0%
tree_edit_gc_100/ (allocs/op) 15,147 allocs 15,147 allocs ⚪ 0%
tree_edit_gc_1000/ (ns/op) 341.83 ms 321.69 ms 🟢 -5.89%
tree_edit_gc_1000/ (B/op) 384.05 MB 384.04 MB ⚪ 0%
tree_edit_gc_1000/ (allocs/op) 154,962 allocs 154,930 allocs 🟢 -0.02%
tree_split_gc_100/ (ns/op) 2.81 ms 2.67 ms 🟢 -4.93%
tree_split_gc_100/ (B/op) 2.41 MB 2.41 MB ⚪ 0%
tree_split_gc_100/ (allocs/op) 11,132 allocs 11,132 allocs ⚪ 0%
tree_split_gc_1000/ (ns/op) 206.54 ms 194.68 ms 🟢 -5.74%
tree_split_gc_1000/ (B/op) 222.50 MB 222.50 MB ⚪ 0%
tree_split_gc_1000/ (allocs/op) 122,064 allocs 122,063 allocs ⚪ 0%
BenchmarkRPC
Benchmark suite Previous Current Change
client_to_server/ (ns/op) 431.30 ms 415.74 ms 🟢 -3.61%
client_to_server/ (B/op) 16.13 MB 16.13 MB 🟢 -0.02%
client_to_server/ (allocs/op) 223,579 allocs 223,578 allocs ⚪ 0%
client_to_client_via_server/ (ns/op) 534.17 ms 503.91 ms 🟢 -5.66%
client_to_client_via_server/ (B/op) 26.68 MB 24.86 MB 🟢 -6.79%
client_to_client_via_server/ (allocs/op) 330,511 allocs 324,215 allocs 🟢 -1.90%
attach_large_document/ (ns/op) 1.31 s 1.26 s 🟢 -3.79%
attach_large_document/ (B/op) 1.92 GB 1.92 GB 🟢 -0.09%
attach_large_document/ (allocs/op) 12,347 allocs 12,221 allocs 🟢 -1.02%
adminCli_to_server/ (ns/op) 546.76 ms 542.33 ms 🟢 -0.81%
adminCli_to_server/ (B/op) 21.71 MB 22.54 MB 🔴 +3.82%
adminCli_to_server/ (allocs/op) 316,680 allocs 316,708 allocs ⚪ 0%
BenchmarkLocker
Benchmark suite Previous Current Change
(ns/op) 83.48 ns 81.54 ns 🟢 -2.32%
(B/op) 32.00 B 32.00 B ⚪ 0%
(allocs/op) 1 allocs 1 allocs ⚪ 0%
BenchmarkLockerParallel
Benchmark suite Previous Current Change
(ns/op) 45.35 ns 44.31 ns 🟢 -2.29%
(B/op) 0.00 B 0.00 B ⚪ 0%
(allocs/op) 0 allocs 0 allocs ⚪ 0%
BenchmarkLockerMoreKeys
Benchmark suite Previous Current Change
(ns/op) 174.90 ns 186.30 ns 🔴 +6.52%
(B/op) 31.00 B 30.00 B 🟢 -3.23%
(allocs/op) 0 allocs 0 allocs ⚪ 0%
BenchmarkRWLocker
Benchmark suite Previous Current Change
RWLock_rate_2/ (ns/op) 50.01 ns 49.75 ns 🟢 -0.52%
RWLock_rate_2/ (B/op) 0.00 B 0.00 B ⚪ 0%
RWLock_rate_2/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
RWLock_rate_10/ (ns/op) 43.22 ns 43.53 ns 🔴 +0.72%
RWLock_rate_10/ (B/op) 0.00 B 0.00 B ⚪ 0%
RWLock_rate_10/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
RWLock_rate_100/ (ns/op) 59.21 ns 59.31 ns 🔴 +0.17%
RWLock_rate_100/ (B/op) 2.00 B 2.00 B ⚪ 0%
RWLock_rate_100/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
RWLock_rate_1000/ (ns/op) 87.90 ns 89.20 ns 🔴 +1.48%
RWLock_rate_1000/ (B/op) 8.00 B 8.00 B ⚪ 0%
RWLock_rate_1000/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
BenchmarkChange
Benchmark suite Previous Current Change
Push_10_Changes/ (ns/op) 4.47 ms 4.42 ms 🟢 -1.14%
Push_10_Changes/ (B/op) 150.30 KB 150.40 KB 🔴 +0.07%
Push_10_Changes/ (allocs/op) 1,618 allocs 1,625 allocs 🔴 +0.43%
Push_100_Changes/ (ns/op) 16.21 ms 15.78 ms 🟢 -2.65%
Push_100_Changes/ (B/op) 774.67 KB 779.29 KB 🔴 +0.60%
Push_100_Changes/ (allocs/op) 8,507 allocs 8,511 allocs 🔴 +0.05%
Push_1000_Changes/ (ns/op) 128.55 ms 126.89 ms 🟢 -1.29%
Push_1000_Changes/ (B/op) 7.31 MB 7.06 MB 🟢 -3.47%
Push_1000_Changes/ (allocs/op) 79,323 allocs 79,329 allocs ⚪ 0%
Pull_10_Changes/ (ns/op) 3.68 ms 3.63 ms 🟢 -1.45%
Pull_10_Changes/ (B/op) 124.52 KB 124.85 KB 🔴 +0.27%
Pull_10_Changes/ (allocs/op) 1,454 allocs 1,454 allocs ⚪ 0%
Pull_100_Changes/ (ns/op) 5.30 ms 5.16 ms 🟢 -2.54%
Pull_100_Changes/ (B/op) 354.81 KB 355.27 KB 🔴 +0.13%
Pull_100_Changes/ (allocs/op) 5,180 allocs 5,179 allocs 🟢 -0.02%
Pull_1000_Changes/ (ns/op) 10.80 ms 10.60 ms 🟢 -1.86%
Pull_1000_Changes/ (B/op) 2.20 MB 2.20 MB 🔴 +0.14%
Pull_1000_Changes/ (allocs/op) 44,680 allocs 44,679 allocs ⚪ 0%
BenchmarkSnapshot
Benchmark suite Previous Current Change
Push_3KB_snapshot/ (ns/op) 18.86 ms 18.07 ms 🟢 -4.16%
Push_3KB_snapshot/ (B/op) 890.17 KB 904.65 KB 🔴 +1.63%
Push_3KB_snapshot/ (allocs/op) 8,516 allocs 8,515 allocs 🟢 -0.01%
Push_30KB_snapshot/ (ns/op) 131.38 ms 130.25 ms 🟢 -0.86%
Push_30KB_snapshot/ (B/op) 8.01 MB 8.07 MB 🔴 +0.71%
Push_30KB_snapshot/ (allocs/op) 87,022 allocs 86,507 allocs 🟢 -0.59%
Pull_3KB_snapshot/ (ns/op) 7.32 ms 7.43 ms 🔴 +1.44%
Pull_3KB_snapshot/ (B/op) 1.06 MB 1.06 MB 🔴 +0.09%
Pull_3KB_snapshot/ (allocs/op) 19,259 allocs 19,256 allocs 🟢 -0.02%
Pull_30KB_snapshot/ (ns/op) 19.44 ms 19.40 ms 🟢 -0.23%
Pull_30KB_snapshot/ (B/op) 8.77 MB 8.76 MB 🟢 -0.04%
Pull_30KB_snapshot/ (allocs/op) 185,673 allocs 185,583 allocs 🟢 -0.05%
BenchmarkSplayTree
Benchmark suite Previous Current Change
stress_test_100000/ (ns/op) 0.19 ns 0.20 ns 🔴 +4.65%
stress_test_100000/ (B/op) 0.00 B 0.00 B ⚪ 0%
stress_test_100000/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
stress_test_200000/ (ns/op) 0.38 ns 0.39 ns 🔴 +2.49%
stress_test_200000/ (B/op) 0.00 B 0.00 B ⚪ 0%
stress_test_200000/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
stress_test_300000/ (ns/op) 0.61 ns 0.58 ns 🟢 -4.72%
stress_test_300000/ (B/op) 0.00 B 0.00 B ⚪ 0%
stress_test_300000/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
random_access_100000/ (ns/op) 0.01 ns 0.01 ns 🟢 -2.84%
random_access_100000/ (B/op) 0.00 B 0.00 B ⚪ 0%
random_access_100000/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
random_access_200000/ (ns/op) 0.03 ns 0.03 ns 🟢 -6.90%
random_access_200000/ (B/op) 0.00 B 0.00 B ⚪ 0%
random_access_200000/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
random_access_300000/ (ns/op) 0.04 ns 0.04 ns 🟢 -2.17%
random_access_300000/ (B/op) 0.00 B 0.00 B ⚪ 0%
random_access_300000/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
editing_trace_bench/ (ns/op) 0.00 ns 0.00 ns 🟢 -30.91%
editing_trace_bench/ (B/op) 0.00 B 0.00 B ⚪ 0%
editing_trace_bench/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
BenchmarkSync
Benchmark suite Previous Current Change
memory_sync_10_test/ (ns/op) 7278.00 ns 7337.00 ns 🔴 +0.81%
memory_sync_10_test/ (B/op) 1.34 KB 1.34 KB 🔴 +0.07%
memory_sync_10_test/ (allocs/op) 35 allocs 35 allocs ⚪ 0%
memory_sync_100_test/ (ns/op) 55524.00 ns 54901.00 ns 🟢 -1.12%
memory_sync_100_test/ (B/op) 9.51 KB 9.52 KB 🔴 +0.08%
memory_sync_100_test/ (allocs/op) 268 allocs 268 allocs ⚪ 0%
memory_sync_1000_test/ (ns/op) 607648.00 ns 610834.00 ns 🔴 +0.52%
memory_sync_1000_test/ (B/op) 76.60 KB 75.86 KB 🟢 -0.96%
memory_sync_1000_test/ (allocs/op) 2,133 allocs 2,109 allocs 🟢 -1.13%
memory_sync_10000_test/ (ns/op) 7.87 ms 7.68 ms 🟢 -2.48%
memory_sync_10000_test/ (B/op) 753.72 KB 754.33 KB 🔴 +0.08%
memory_sync_10000_test/ (allocs/op) 20,438 allocs 20,413 allocs 🟢 -0.12%
BenchmarkTextEditing
Benchmark suite Previous Current Change
(ns/op) 5.32 s 5.28 s 🟢 -0.78%
(B/op) 3.92 GB 3.92 GB ⚪ 0%
(allocs/op) 20,619,803 allocs 20,619,933 allocs ⚪ 0%
BenchmarkTree
Benchmark suite Previous Current Change
10000_vertices_to_protobuf/ (ns/op) 4.52 ms 4.36 ms 🟢 -3.59%
10000_vertices_to_protobuf/ (B/op) 6.36 MB 6.36 MB ⚪ 0%
10000_vertices_to_protobuf/ (allocs/op) 70,025 allocs 70,025 allocs ⚪ 0%
10000_vertices_from_protobuf/ (ns/op) 228.67 ms 221.28 ms 🟢 -3.23%
10000_vertices_from_protobuf/ (B/op) 442.30 MB 442.31 MB ⚪ 0%
10000_vertices_from_protobuf/ (allocs/op) 290,039 allocs 290,048 allocs ⚪ 0%
20000_vertices_to_protobuf/ (ns/op) 9.47 ms 9.00 ms 🟢 -4.92%
20000_vertices_to_protobuf/ (B/op) 12.89 MB 12.89 MB ⚪ 0%
20000_vertices_to_protobuf/ (allocs/op) 140,028 allocs 140,028 allocs ⚪ 0%
20000_vertices_from_protobuf/ (ns/op) 878.69 ms 886.47 ms 🔴 +0.89%
20000_vertices_from_protobuf/ (B/op) 1.70 GB 1.70 GB ⚪ 0%
20000_vertices_from_protobuf/ (allocs/op) 580,090 allocs 580,123 allocs ⚪ 0%
30000_vertices_to_protobuf/ (ns/op) 13.65 ms 14.42 ms 🔴 +5.57%
30000_vertices_to_protobuf/ (B/op) 18.98 MB 18.98 MB ⚪ 0%
30000_vertices_to_protobuf/ (allocs/op) 210,029 allocs 210,029 allocs ⚪ 0%
30000_vertices_from_protobuf/ (ns/op) 2.09 s 2.01 s 🟢 -3.98%
30000_vertices_from_protobuf/ (B/op) 3.75 GB 3.75 GB ⚪ 0%
30000_vertices_from_protobuf/ (allocs/op) 870,147 allocs 870,131 allocs ⚪ 0%
BenchmarkVersionVector
Benchmark suite Previous Current Change
clients_10/ (ns/op) 159.13 ms 157.99 ms 🟢 -0.72%
clients_10/ (1_changepack(bytes)) 745.00 B 745.00 B ⚪ 0%
clients_10/ (2_snapshot(bytes)) 379.00 B 379.00 B ⚪ 0%
clients_10/ (3_pushpull(ms)) 8.00 ms 7.00 ms 🟢 -12.50%
clients_10/ (4_attach(ms)) 6.00 ms 6.00 ms ⚪ 0%
clients_10/ (5_changepack_after_detach(bytes)) 805.00 B 805.00 B ⚪ 0%
clients_10/ (6_snapshot_after_detach(bytes)) 136.00 B 136.00 B ⚪ 0%
clients_10/ (7_pushpull_after_detach(ms)) 8.00 ms 8.00 ms ⚪ 0%
clients_10/ (B/op) 20.01 MB 20.62 MB 🔴 +3.05%
clients_10/ (allocs/op) 83,228 allocs 83,287 allocs 🔴 +0.07%
clients_100/ (ns/op) 1.40 s 1.38 s 🟢 -1.66%
clients_100/ (1_changepack(bytes)) 6.14 KB 6.14 KB ⚪ 0%
clients_100/ (2_snapshot(bytes)) 3.08 KB 3.08 KB ⚪ 0%
clients_100/ (3_pushpull(ms)) 11.00 ms 11.00 ms ⚪ 0%
clients_100/ (4_attach(ms)) 9.00 ms 9.00 ms ⚪ 0%
clients_100/ (5_changepack_after_detach(bytes)) 6.21 KB 6.21 KB ⚪ 0%
clients_100/ (6_snapshot_after_detach(bytes)) 137.00 B 137.00 B ⚪ 0%
clients_100/ (7_pushpull_after_detach(ms)) 9.00 ms 9.00 ms ⚪ 0%
clients_100/ (B/op) 215.15 MB 216.75 MB 🔴 +0.75%
clients_100/ (allocs/op) 1,481,377 allocs 1,481,396 allocs ⚪ 0%
clients_1000/ (ns/op) 42.81 s 42.26 s 🟢 -1.27%
clients_1000/ (1_changepack(bytes)) 60.16 KB 60.16 KB ⚪ 0%
clients_1000/ (2_snapshot(bytes)) 30.08 KB 30.08 KB ⚪ 0%
clients_1000/ (3_pushpull(ms)) 114.00 ms 119.00 ms 🔴 +4.39%
clients_1000/ (4_attach(ms)) 72.00 ms 72.00 ms ⚪ 0%
clients_1000/ (5_changepack_after_detach(bytes)) 60.22 KB 60.22 KB ⚪ 0%
clients_1000/ (6_snapshot_after_detach(bytes)) 139.00 B 139.00 B ⚪ 0%
clients_1000/ (7_pushpull_after_detach(ms)) 22.00 ms 20.00 ms 🟢 -9.09%
clients_1000/ (B/op) 6.43 GB 6.43 GB ⚪ 0%
clients_1000/ (allocs/op) 93,355,010 allocs 93,355,841 allocs ⚪ 0%

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

♻️ Duplicate comments (1)
pkg/limit/limiter.go (1)

128-155: ⚠️ Potential issue

for range l.expireBatchSize may cause compatibility issues.
If the project is still on Go 1.21, this syntax will not compile because expireBatchSize is an integer. For broad compatibility, consider using a conventional index-based loop.

Proposed fix:

-for range l.expireBatchSize {
+for i := 0; i < l.expireBatchSize; i++ {
    // ...
}
🧹 Nitpick comments (7)
test/bench/webhook_bench_test.go (1)

19-31: Run goimports to fix import ordering.

According to the static analysis hint, this file is not goimports-ed with the -local github.com/yorkie-team/yorkie option. Consider running goimports or configuring your editor/IDE to apply the import ordering to align with the project style.

🧰 Tools
🪛 golangci-lint (1.62.2)

27-27: File is not goimports-ed with -local github.com/yorkie-team/yorkie

(goimports)

test/integration/event_webhook_test.go (3)

52-52: Improve error message clarity.

Using only assert.NoError(t, err) makes test failures less descriptive. Consider adding a custom error message to clarify which signature check failed.

-assert.NoError(t, helper.VerifySignature(signatureHeader, secretKey, body))
+assert.NoError(t, helper.VerifySignature(signatureHeader, secretKey, body), "Invalid signature in newWebhookServer")

86-161: Consider adding negative test coverage.

"TestRegisterEventWebhook" covers registration and unregistration under normal conditions. As an enhancement, consider additional tests for:

  • Invalid webhook URL (malformed, unreachable, etc.).
  • Empty or missing EventWebhookEvents.
    This helps ensure robust handling of exceptional cases.

277-345: Reduce potential test flakiness with time-based checks.

Repeatedly using time.Sleep can introduce flakiness if system resources are limited. Consider replacing it with conditional loops that poll reqCnt until it meets the expected threshold or the timeout is reached.

server/backend/webhook/manager.go (3)

33-44: Offer configuration for placeholders.

The constants expireInterval, throttleWindow, and debouncingTime are hard-coded. The TODO indicates a plan to make them configurable. Let me know if you'd like assistance in implementing CLI/config file parameters for these fields.


60-75: Consider error propagation when callback fails.

In Send(), if the callback fails to send, the error is only logged. Callers don't receive the error for debounced events. Verify if silent failures are acceptable behavior.


81-103: Log additional details on non-200 status codes.

Currently, the logic only returns ErrUnexpectedStatusCode. Consider logging or handling specific 4xx/5xx codes for better observability in diagnosing issues.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 261ef28 and 48e7f65.

📒 Files selected for processing (6)
  • pkg/limit/limiter.go (1 hunks)
  • pkg/webhook/client_test.go (2 hunks)
  • server/backend/webhook/manager.go (1 hunks)
  • test/bench/webhook_bench_test.go (1 hunks)
  • test/helper/helper.go (2 hunks)
  • test/integration/event_webhook_test.go (5 hunks)
🧰 Additional context used
🧠 Learnings (1)
pkg/limit/limiter.go (1)
Learnt from: window9u
PR: yorkie-team/yorkie#1166
File: pkg/limit/limiter.go:132-132
Timestamp: 2025-03-07T10:41:57.466Z
Learning: Go 1.23, released in August 2024, added support for `for range` loops with integers. However, the project currently uses Go 1.21, which does not support this syntax.
🪛 golangci-lint (1.62.2)
test/bench/webhook_bench_test.go

27-27: File is not goimports-ed with -local github.com/yorkie-team/yorkie

(goimports)

⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: bench
  • GitHub Check: build
🔇 Additional comments (14)
test/helper/helper.go (2)

22-25: Imports for cryptographic operations look good.
No issues found with adding hmac, sha256, hex, and errors to support the new signature verification logic.


85-96: HMAC signature verification logic is solid.
The function correctly uses hmac.Equal for a constant-time comparison, mitigating timing attacks. The prefix sha256= is also validated by exact string matching.

pkg/webhook/client_test.go (2)

16-16: Importing the helper package is appropriate.
Centralizing signature verification logic in test/helper improves reusability.


45-45: Refactor to use the helper's HMAC verification.
Replacing the local verification function with helper.VerifySignature ensures consistency across the codebase.

pkg/limit/limiter.go (3)

1-65: General structure of the Limiter implementation looks good.
The Limiter type is well-defined with a dedicated evictionList and entries map. The constructor starts a background goroutine to handle expiration, which is a neat design.


75-107: Allow() method logic is clear and thread-safe.
Locking ensures consistency when updating entries, and the approach of clearing or deferring callbacks is appropriate for debouncing.


168-181: Close() method responsibly cleans up resources.
Waiting for all goroutines to finish ensures consistent shutdown. No further issues found.

test/bench/webhook_bench_test.go (1)

45-83: Looks good overall.

The sub-benchmarks are well-structured, iterating over different configurations. Execution time is controlled by the internal loops. No immediate logical or performance issues are apparent aside from the loop syntax concerns addressed in the other functions.

test/integration/event_webhook_test.go (4)

163-200: Looks good.

The “root element changed test” verifies the root-change event correctly triggers the webhook. The logic is clear, and use of time.Sleep(waitWebhookReceived) is acceptable for basic synchronization here.


201-236: No issues.

The “presence changed test” ensures that a DocRootChanged event is not triggered for presence changes alone. The assertions look correct.


238-275: No issues with combined changes.

The “root element and presence changed test” scenario correctly validates that root changes trigger the event, while presence changes do not affect it. Nicely done.


347-414: Approve final teardown test.

"TestCloseEventManager" ensures event flush on server shutdown. The approach looks solid, verifying the final count. The usage of relaxed sleeps is acceptable here, though a poll-based approach might further reduce flakiness in CI.

server/backend/webhook/manager.go (2)

46-58: Approve the Manager creation.

NewManager sets up an internal rate limiter and associates it with the provided client. Code is succinct and meets the immediate need for event throttling and debouncing.


76-80: Graceful close mechanism is appropriate.

Calling m.limiter.Close() ensures that pending debounced events are flushed. This design is good for ensuring no events are lost upon server shutdown.

Comment thread test/bench/webhook_bench_test.go
Comment thread test/bench/webhook_bench_test.go
Comment thread test/bench/webhook_bench_test.go

@hackerwins-yorkie hackerwins-yorkie left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Go Benchmark Analysis 📊

This is a comparison result between the previous(68c233b) and the current commit(c338372).

Significant Changes (≥20% difference)

Benchmark suite Previous Current Change
BenchmarkSplayTree/editing_trace_bench/ (ns/op) 0.00 ns 0.00 ns 🟢 -35.64%

Key Observations 🔍

  • The BenchmarkSplayTree/editing_trace_bench/ suite showed a significant improvement with a decrease of 35.64% in execution time, indicating optimization in the editing trace benchmark.
  • In the BenchmarkDocument suite, notable improvements were observed in various tests, such as a decrease in execution time for nested_update_test/, delete_test/, array_test/, and text_delete_all_100000/ by 19.29%, 1.73%, 9.27%, and 6.20% respectively.
  • The BenchmarkWebhook suite introduced new tests with varying delays and number of endpoints, showcasing different performance metrics for webhook sending operations.

Detailed Test Results

BenchmarkDocument
Benchmark suite Previous Current Change
constructor_test/ (ns/op) 1475.00 ns 1472.00 ns 🟢 -0.20%
constructor_test/ (B/op) 1.43 KB 1.43 KB ⚪ 0%
constructor_test/ (allocs/op) 25 allocs 25 allocs ⚪ 0%
status_test/ (ns/op) 1070.00 ns 1073.00 ns 🔴 +0.28%
status_test/ (B/op) 1.40 KB 1.40 KB ⚪ 0%
status_test/ (allocs/op) 23 allocs 23 allocs ⚪ 0%
equals_test/ (ns/op) 7923.00 ns 7857.00 ns 🟢 -0.83%
equals_test/ (B/op) 7.71 KB 7.71 KB ⚪ 0%
equals_test/ (allocs/op) 132 allocs 132 allocs ⚪ 0%
nested_update_test/ (ns/op) 16818.00 ns 20062.00 ns 🔴 +19.29%
nested_update_test/ (B/op) 12.36 KB 12.35 KB ⚪ 0%
nested_update_test/ (allocs/op) 259 allocs 259 allocs ⚪ 0%
delete_test/ (ns/op) 22897.00 ns 22501.00 ns 🟢 -1.73%
delete_test/ (B/op) 15.84 KB 15.84 KB ⚪ 0%
delete_test/ (allocs/op) 340 allocs 340 allocs ⚪ 0%
object_test/ (ns/op) 8584.00 ns 8538.00 ns 🟢 -0.54%
object_test/ (B/op) 7.08 KB 7.08 KB ⚪ 0%
object_test/ (allocs/op) 119 allocs 119 allocs ⚪ 0%
array_test/ (ns/op) 30978.00 ns 28105.00 ns 🟢 -9.27%
array_test/ (B/op) 12.19 KB 12.19 KB ⚪ 0%
array_test/ (allocs/op) 274 allocs 274 allocs ⚪ 0%
text_test/ (ns/op) 31716.00 ns 31469.00 ns 🟢 -0.78%
text_test/ (B/op) 15.24 KB 15.24 KB ⚪ 0%
text_test/ (allocs/op) 485 allocs 485 allocs ⚪ 0%
text_composition_test/ (ns/op) 31494.00 ns 31749.00 ns 🔴 +0.81%
text_composition_test/ (B/op) 18.75 KB 18.75 KB ⚪ 0%
text_composition_test/ (allocs/op) 502 allocs 502 allocs ⚪ 0%
rich_text_test/ (ns/op) 86630.00 ns 85223.00 ns 🟢 -1.62%
rich_text_test/ (B/op) 39.40 KB 39.41 KB 🔴 +0.02%
rich_text_test/ (allocs/op) 1,147 allocs 1,147 allocs ⚪ 0%
counter_test/ (ns/op) 18162.00 ns 18015.00 ns 🟢 -0.81%
counter_test/ (B/op) 11.86 KB 11.86 KB ⚪ 0%
counter_test/ (allocs/op) 254 allocs 254 allocs ⚪ 0%
text_edit_gc_100/ (ns/op) 1.38 ms 1.38 ms 🟢 -0.66%
text_edit_gc_100/ (B/op) 864.94 KB 864.96 KB ⚪ 0%
text_edit_gc_100/ (allocs/op) 17,282 allocs 17,283 allocs ⚪ 0%
text_edit_gc_1000/ (ns/op) 52.60 ms 52.63 ms 🔴 +0.04%
text_edit_gc_1000/ (B/op) 46.84 MB 46.84 MB ⚪ 0%
text_edit_gc_1000/ (allocs/op) 185,598 allocs 185,589 allocs ⚪ 0%
text_split_gc_100/ (ns/op) 2.10 ms 2.11 ms 🔴 +0.34%
text_split_gc_100/ (B/op) 1.58 MB 1.58 MB ⚪ 0%
text_split_gc_100/ (allocs/op) 15,951 allocs 15,951 allocs ⚪ 0%
text_split_gc_1000/ (ns/op) 127.99 ms 126.69 ms 🟢 -1.02%
text_split_gc_1000/ (B/op) 137.79 MB 137.79 MB ⚪ 0%
text_split_gc_1000/ (allocs/op) 184,982 allocs 184,989 allocs ⚪ 0%
text_delete_all_10000/ (ns/op) 17.22 ms 16.66 ms 🟢 -3.23%
text_delete_all_10000/ (B/op) 10.58 MB 10.58 MB ⚪ 0%
text_delete_all_10000/ (allocs/op) 56,134 allocs 56,134 allocs ⚪ 0%
text_delete_all_100000/ (ns/op) 299.69 ms 281.10 ms 🟢 -6.20%
text_delete_all_100000/ (B/op) 105.53 MB 105.52 MB 🟢 -0.02%
text_delete_all_100000/ (allocs/op) 566,117 allocs 566,058 allocs 🟢 -0.01%
text_100/ (ns/op) 246721.00 ns 228001.00 ns 🟢 -7.59%
text_100/ (B/op) 120.95 KB 120.95 KB ⚪ 0%
text_100/ (allocs/op) 5,182 allocs 5,182 allocs ⚪ 0%
text_1000/ (ns/op) 2.56 ms 2.42 ms 🟢 -5.28%
text_1000/ (B/op) 1.16 MB 1.16 MB ⚪ 0%
text_1000/ (allocs/op) 51,085 allocs 51,085 allocs ⚪ 0%
array_1000/ (ns/op) 1.31 ms 1.24 ms 🟢 -5.79%
array_1000/ (B/op) 1.09 MB 1.09 MB ⚪ 0%
array_1000/ (allocs/op) 11,880 allocs 11,880 allocs ⚪ 0%
array_10000/ (ns/op) 13.65 ms 13.28 ms 🟢 -2.70%
array_10000/ (B/op) 9.89 MB 9.89 MB 🟢 -0.01%
array_10000/ (allocs/op) 120,736 allocs 120,732 allocs ⚪ 0%
array_gc_100/ (ns/op) 138092.00 ns 132023.00 ns 🟢 -4.39%
array_gc_100/ (B/op) 99.93 KB 99.94 KB 🔴 +0.01%
array_gc_100/ (allocs/op) 1,267 allocs 1,267 allocs ⚪ 0%
array_gc_1000/ (ns/op) 1.48 ms 1.42 ms 🟢 -4.24%
array_gc_1000/ (B/op) 1.14 MB 1.14 MB ⚪ 0%
array_gc_1000/ (allocs/op) 12,927 allocs 12,927 allocs ⚪ 0%
counter_1000/ (ns/op) 213454.00 ns 199922.00 ns 🟢 -6.34%
counter_1000/ (B/op) 178.18 KB 178.18 KB ⚪ 0%
counter_1000/ (allocs/op) 5,772 allocs 5,772 allocs ⚪ 0%
counter_10000/ (ns/op) 2.23 ms 2.13 ms 🟢 -4.18%
counter_10000/ (B/op) 2.07 MB 2.07 MB ⚪ 0%
counter_10000/ (allocs/op) 59,779 allocs 59,779 allocs ⚪ 0%
object_1000/ (ns/op) 1.48 ms 1.39 ms 🟢 -5.85%
object_1000/ (B/op) 1.44 MB 1.44 MB ⚪ 0%
object_1000/ (allocs/op) 9,926 allocs 9,926 allocs ⚪ 0%
object_10000/ (ns/op) 15.34 ms 14.73 ms 🟢 -3.97%
object_10000/ (B/op) 12.35 MB 12.35 MB 🟢 -0.02%
object_10000/ (allocs/op) 101,234 allocs 101,228 allocs ⚪ 0%
tree_100/ (ns/op) 1.11 ms 1.04 ms 🟢 -6.56%
tree_100/ (B/op) 951.08 KB 951.08 KB ⚪ 0%
tree_100/ (allocs/op) 6,103 allocs 6,103 allocs ⚪ 0%
tree_1000/ (ns/op) 81.61 ms 76.77 ms 🟢 -5.94%
tree_1000/ (B/op) 86.58 MB 86.58 MB ⚪ 0%
tree_1000/ (allocs/op) 60,112 allocs 60,113 allocs ⚪ 0%
tree_10000/ (ns/op) 9.93 s 9.34 s 🟢 -5.93%
tree_10000/ (B/op) 8.58 GB 8.58 GB ⚪ 0%
tree_10000/ (allocs/op) 600,184 allocs 600,206 allocs ⚪ 0%
tree_delete_all_1000/ (ns/op) 83.08 ms 76.30 ms 🟢 -8.17%
tree_delete_all_1000/ (B/op) 87.57 MB 87.57 MB ⚪ 0%
tree_delete_all_1000/ (allocs/op) 75,291 allocs 75,288 allocs ⚪ 0%
tree_edit_gc_100/ (ns/op) 4.08 ms 3.80 ms 🟢 -6.95%
tree_edit_gc_100/ (B/op) 4.15 MB 4.15 MB ⚪ 0%
tree_edit_gc_100/ (allocs/op) 15,147 allocs 15,147 allocs ⚪ 0%
tree_edit_gc_1000/ (ns/op) 341.83 ms 309.54 ms 🟢 -9.45%
tree_edit_gc_1000/ (B/op) 384.05 MB 384.04 MB ⚪ 0%
tree_edit_gc_1000/ (allocs/op) 154,962 allocs 154,939 allocs 🟢 -0.01%
tree_split_gc_100/ (ns/op) 2.81 ms 2.60 ms 🟢 -7.59%
tree_split_gc_100/ (B/op) 2.41 MB 2.41 MB ⚪ 0%
tree_split_gc_100/ (allocs/op) 11,132 allocs 11,132 allocs ⚪ 0%
tree_split_gc_1000/ (ns/op) 206.54 ms 187.15 ms 🟢 -9.39%
tree_split_gc_1000/ (B/op) 222.50 MB 222.50 MB ⚪ 0%
tree_split_gc_1000/ (allocs/op) 122,064 allocs 122,059 allocs ⚪ 0%
BenchmarkRPC
Benchmark suite Previous Current Change
client_to_server/ (ns/op) 431.30 ms 415.74 ms 🟢 -3.61%
client_to_server/ (B/op) 16.13 MB 16.14 MB 🔴 +0.02%
client_to_server/ (allocs/op) 223,579 allocs 223,539 allocs 🟢 -0.02%
client_to_client_via_server/ (ns/op) 534.17 ms 501.88 ms 🟢 -6.04%
client_to_client_via_server/ (B/op) 26.68 MB 29.16 MB 🔴 +9.30%
client_to_client_via_server/ (allocs/op) 330,511 allocs 323,679 allocs 🟢 -2.07%
attach_large_document/ (ns/op) 1.31 s 1.22 s 🟢 -6.99%
attach_large_document/ (B/op) 1.92 GB 1.92 GB 🔴 +0.04%
attach_large_document/ (allocs/op) 12,347 allocs 12,212 allocs 🟢 -1.09%
adminCli_to_server/ (ns/op) 546.76 ms 535.11 ms 🟢 -2.13%
adminCli_to_server/ (B/op) 21.71 MB 21.32 MB 🟢 -1.82%
adminCli_to_server/ (allocs/op) 316,680 allocs 316,658 allocs ⚪ 0%
BenchmarkLocker
Benchmark suite Previous Current Change
(ns/op) 83.48 ns 82.07 ns 🟢 -1.69%
(B/op) 32.00 B 32.00 B ⚪ 0%
(allocs/op) 1 allocs 1 allocs ⚪ 0%
BenchmarkLockerParallel
Benchmark suite Previous Current Change
(ns/op) 45.35 ns 44.52 ns 🟢 -1.83%
(B/op) 0.00 B 0.00 B ⚪ 0%
(allocs/op) 0 allocs 0 allocs ⚪ 0%
BenchmarkLockerMoreKeys
Benchmark suite Previous Current Change
(ns/op) 174.90 ns 176.30 ns 🔴 +0.80%
(B/op) 31.00 B 31.00 B ⚪ 0%
(allocs/op) 0 allocs 0 allocs ⚪ 0%
BenchmarkRWLocker
Benchmark suite Previous Current Change
RWLock_rate_2/ (ns/op) 50.01 ns 49.04 ns 🟢 -1.94%
RWLock_rate_2/ (B/op) 0.00 B 0.00 B ⚪ 0%
RWLock_rate_2/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
RWLock_rate_10/ (ns/op) 43.22 ns 44.36 ns 🔴 +2.64%
RWLock_rate_10/ (B/op) 0.00 B 0.00 B ⚪ 0%
RWLock_rate_10/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
RWLock_rate_100/ (ns/op) 59.21 ns 59.88 ns 🔴 +1.13%
RWLock_rate_100/ (B/op) 2.00 B 2.00 B ⚪ 0%
RWLock_rate_100/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
RWLock_rate_1000/ (ns/op) 87.90 ns 87.73 ns 🟢 -0.19%
RWLock_rate_1000/ (B/op) 8.00 B 8.00 B ⚪ 0%
RWLock_rate_1000/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
BenchmarkChange
Benchmark suite Previous Current Change
Push_10_Changes/ (ns/op) 4.47 ms 4.45 ms 🟢 -0.54%
Push_10_Changes/ (B/op) 150.30 KB 150.99 KB 🔴 +0.46%
Push_10_Changes/ (allocs/op) 1,618 allocs 1,625 allocs 🔴 +0.43%
Push_100_Changes/ (ns/op) 16.21 ms 15.88 ms 🟢 -2.01%
Push_100_Changes/ (B/op) 774.67 KB 785.96 KB 🔴 +1.46%
Push_100_Changes/ (allocs/op) 8,507 allocs 8,513 allocs 🔴 +0.07%
Push_1000_Changes/ (ns/op) 128.55 ms 128.84 ms 🔴 +0.23%
Push_1000_Changes/ (B/op) 7.31 MB 7.21 MB 🟢 -1.33%
Push_1000_Changes/ (allocs/op) 79,323 allocs 79,327 allocs ⚪ 0%
Pull_10_Changes/ (ns/op) 3.68 ms 3.65 ms 🟢 -0.74%
Pull_10_Changes/ (B/op) 124.52 KB 124.80 KB 🔴 +0.22%
Pull_10_Changes/ (allocs/op) 1,454 allocs 1,454 allocs ⚪ 0%
Pull_100_Changes/ (ns/op) 5.30 ms 5.20 ms 🟢 -1.82%
Pull_100_Changes/ (B/op) 354.81 KB 355.24 KB 🔴 +0.12%
Pull_100_Changes/ (allocs/op) 5,180 allocs 5,180 allocs ⚪ 0%
Pull_1000_Changes/ (ns/op) 10.80 ms 10.46 ms 🟢 -3.19%
Pull_1000_Changes/ (B/op) 2.20 MB 2.20 MB 🔴 +0.13%
Pull_1000_Changes/ (allocs/op) 44,680 allocs 44,681 allocs ⚪ 0%
BenchmarkSnapshot
Benchmark suite Previous Current Change
Push_3KB_snapshot/ (ns/op) 18.86 ms 18.59 ms 🟢 -1.39%
Push_3KB_snapshot/ (B/op) 890.17 KB 908.34 KB 🔴 +2.04%
Push_3KB_snapshot/ (allocs/op) 8,516 allocs 8,520 allocs 🔴 +0.05%
Push_30KB_snapshot/ (ns/op) 131.38 ms 133.13 ms 🔴 +1.33%
Push_30KB_snapshot/ (B/op) 8.01 MB 8.05 MB 🔴 +0.46%
Push_30KB_snapshot/ (allocs/op) 87,022 allocs 86,299 allocs 🟢 -0.83%
Pull_3KB_snapshot/ (ns/op) 7.32 ms 7.22 ms 🟢 -1.37%
Pull_3KB_snapshot/ (B/op) 1.06 MB 1.06 MB 🔴 +0.07%
Pull_3KB_snapshot/ (allocs/op) 19,259 allocs 19,258 allocs ⚪ 0%
Pull_30KB_snapshot/ (ns/op) 19.44 ms 18.86 ms 🟢 -2.99%
Pull_30KB_snapshot/ (B/op) 8.77 MB 8.77 MB 🔴 +0.06%
Pull_30KB_snapshot/ (allocs/op) 185,673 allocs 185,671 allocs ⚪ 0%
BenchmarkSplayTree
Benchmark suite Previous Current Change
stress_test_100000/ (ns/op) 0.19 ns 0.19 ns ⚪ 0%
stress_test_100000/ (B/op) 0.00 B 0.00 B ⚪ 0%
stress_test_100000/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
stress_test_200000/ (ns/op) 0.38 ns 0.39 ns 🔴 +2.39%
stress_test_200000/ (B/op) 0.00 B 0.00 B ⚪ 0%
stress_test_200000/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
stress_test_300000/ (ns/op) 0.61 ns 0.59 ns 🟢 -3.47%
stress_test_300000/ (B/op) 0.00 B 0.00 B ⚪ 0%
stress_test_300000/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
random_access_100000/ (ns/op) 0.01 ns 0.01 ns 🔴 +3.95%
random_access_100000/ (B/op) 0.00 B 0.00 B ⚪ 0%
random_access_100000/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
random_access_200000/ (ns/op) 0.03 ns 0.03 ns 🔴 +2.67%
random_access_200000/ (B/op) 0.00 B 0.00 B ⚪ 0%
random_access_200000/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
random_access_300000/ (ns/op) 0.04 ns 0.04 ns 🔴 +1.98%
random_access_300000/ (B/op) 0.00 B 0.00 B ⚪ 0%
random_access_300000/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
editing_trace_bench/ (ns/op) 0.00 ns 0.00 ns 🟢 -35.64%
editing_trace_bench/ (B/op) 0.00 B 0.00 B ⚪ 0%
editing_trace_bench/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
BenchmarkSync
Benchmark suite Previous Current Change
memory_sync_10_test/ (ns/op) 7278.00 ns 7116.00 ns 🟢 -2.23%
memory_sync_10_test/ (B/op) 1.34 KB 1.34 KB 🔴 +0.07%
memory_sync_10_test/ (allocs/op) 35 allocs 35 allocs ⚪ 0%
memory_sync_100_test/ (ns/op) 55524.00 ns 54879.00 ns 🟢 -1.16%
memory_sync_100_test/ (B/op) 9.51 KB 9.50 KB 🟢 -0.09%
memory_sync_100_test/ (allocs/op) 268 allocs 268 allocs ⚪ 0%
memory_sync_1000_test/ (ns/op) 607648.00 ns 608194.00 ns 🔴 +0.09%
memory_sync_1000_test/ (B/op) 76.60 KB 75.64 KB 🟢 -1.26%
memory_sync_1000_test/ (allocs/op) 2,133 allocs 2,102 allocs 🟢 -1.45%
memory_sync_10000_test/ (ns/op) 7.87 ms 7.42 ms 🟢 -5.71%
memory_sync_10000_test/ (B/op) 753.72 KB 756.13 KB 🔴 +0.32%
memory_sync_10000_test/ (allocs/op) 20,438 allocs 20,452 allocs 🔴 +0.07%
BenchmarkTextEditing
Benchmark suite Previous Current Change
(ns/op) 5.32 s 5.19 s 🟢 -2.42%
(B/op) 3.92 GB 3.92 GB ⚪ 0%
(allocs/op) 20,619,803 allocs 20,619,966 allocs ⚪ 0%
BenchmarkTree
Benchmark suite Previous Current Change
10000_vertices_to_protobuf/ (ns/op) 4.52 ms 4.14 ms 🟢 -8.35%
10000_vertices_to_protobuf/ (B/op) 6.36 MB 6.36 MB ⚪ 0%
10000_vertices_to_protobuf/ (allocs/op) 70,025 allocs 70,025 allocs ⚪ 0%
10000_vertices_from_protobuf/ (ns/op) 228.67 ms 220.83 ms 🟢 -3.43%
10000_vertices_from_protobuf/ (B/op) 442.30 MB 442.31 MB ⚪ 0%
10000_vertices_from_protobuf/ (allocs/op) 290,039 allocs 290,047 allocs ⚪ 0%
20000_vertices_to_protobuf/ (ns/op) 9.47 ms 8.98 ms 🟢 -5.18%
20000_vertices_to_protobuf/ (B/op) 12.89 MB 12.89 MB ⚪ 0%
20000_vertices_to_protobuf/ (allocs/op) 140,028 allocs 140,028 allocs ⚪ 0%
20000_vertices_from_protobuf/ (ns/op) 878.69 ms 881.73 ms 🔴 +0.35%
20000_vertices_from_protobuf/ (B/op) 1.70 GB 1.70 GB ⚪ 0%
20000_vertices_from_protobuf/ (allocs/op) 580,090 allocs 580,128 allocs ⚪ 0%
30000_vertices_to_protobuf/ (ns/op) 13.65 ms 13.83 ms 🔴 +1.27%
30000_vertices_to_protobuf/ (B/op) 18.98 MB 18.98 MB ⚪ 0%
30000_vertices_to_protobuf/ (allocs/op) 210,029 allocs 210,029 allocs ⚪ 0%
30000_vertices_from_protobuf/ (ns/op) 2.09 s 1.98 s 🟢 -5.43%
30000_vertices_from_protobuf/ (B/op) 3.75 GB 3.75 GB ⚪ 0%
30000_vertices_from_protobuf/ (allocs/op) 870,147 allocs 870,170 allocs ⚪ 0%
BenchmarkVersionVector
Benchmark suite Previous Current Change
clients_10/ (ns/op) 159.13 ms 157.54 ms 🟢 -1.00%
clients_10/ (1_changepack(bytes)) 745.00 B 745.00 B ⚪ 0%
clients_10/ (2_snapshot(bytes)) 379.00 B 379.00 B ⚪ 0%
clients_10/ (3_pushpull(ms)) 8.00 ms 7.00 ms 🟢 -12.50%
clients_10/ (4_attach(ms)) 6.00 ms 6.00 ms ⚪ 0%
clients_10/ (5_changepack_after_detach(bytes)) 805.00 B 805.00 B ⚪ 0%
clients_10/ (6_snapshot_after_detach(bytes)) 136.00 B 136.00 B ⚪ 0%
clients_10/ (7_pushpull_after_detach(ms)) 8.00 ms 8.00 ms ⚪ 0%
clients_10/ (B/op) 20.01 MB 20.27 MB 🔴 +1.30%
clients_10/ (allocs/op) 83,228 allocs 83,249 allocs 🔴 +0.03%
clients_100/ (ns/op) 1.40 s 1.39 s 🟢 -0.66%
clients_100/ (1_changepack(bytes)) 6.14 KB 6.14 KB ⚪ 0%
clients_100/ (2_snapshot(bytes)) 3.08 KB 3.08 KB ⚪ 0%
clients_100/ (3_pushpull(ms)) 11.00 ms 11.00 ms ⚪ 0%
clients_100/ (4_attach(ms)) 9.00 ms 9.00 ms ⚪ 0%
clients_100/ (5_changepack_after_detach(bytes)) 6.21 KB 6.21 KB ⚪ 0%
clients_100/ (6_snapshot_after_detach(bytes)) 137.00 B 137.00 B ⚪ 0%
clients_100/ (7_pushpull_after_detach(ms)) 9.00 ms 9.00 ms ⚪ 0%
clients_100/ (B/op) 215.15 MB 216.83 MB 🔴 +0.78%
clients_100/ (allocs/op) 1,481,377 allocs 1,481,504 allocs ⚪ 0%
clients_1000/ (ns/op) 42.81 s 42.34 s 🟢 -1.09%
clients_1000/ (1_changepack(bytes)) 60.16 KB 60.16 KB ⚪ 0%
clients_1000/ (2_snapshot(bytes)) 30.08 KB 30.08 KB ⚪ 0%
clients_1000/ (3_pushpull(ms)) 114.00 ms 112.00 ms 🟢 -1.75%
clients_1000/ (4_attach(ms)) 72.00 ms 72.00 ms ⚪ 0%
clients_1000/ (5_changepack_after_detach(bytes)) 60.22 KB 60.22 KB ⚪ 0%
clients_1000/ (6_snapshot_after_detach(bytes)) 139.00 B 139.00 B ⚪ 0%
clients_1000/ (7_pushpull_after_detach(ms)) 22.00 ms 22.00 ms ⚪ 0%
clients_1000/ (B/op) 6.43 GB 6.43 GB ⚪ 0%
clients_1000/ (allocs/op) 93,355,010 allocs 93,355,801 allocs ⚪ 0%
BenchmarkWebhook
Benchmark suite Previous Current Change
Send_10_Webhooks_to_10_Endpoints_with_delay_0s/ (ns/op) N/A 12.07 ms ✅ New
Send_10_Webhooks_to_10_Endpoints_with_delay_0s/ (B/op) N/A 808.80 KB ✅ New
Send_10_Webhooks_to_10_Endpoints_with_delay_0s/ (allocs/op) N/A 10,113 allocs ✅ New
Send_10_Webhooks_to_10_Endpoints_limiter_with_delay_0s/ (ns/op) N/A 17105.00 ns ✅ New
Send_10_Webhooks_to_10_Endpoints_limiter_with_delay_0s/ (B/op) N/A 12.80 KB ✅ New
Send_10_Webhooks_to_10_Endpoints_limiter_with_delay_0s/ (allocs/op) N/A 100 allocs ✅ New
Send_100_Webhooks_to_10_Endpoints_with_delay_0s/ (ns/op) N/A 120.22 ms ✅ New
Send_100_Webhooks_to_10_Endpoints_with_delay_0s/ (B/op) N/A 8.11 MB ✅ New
Send_100_Webhooks_to_10_Endpoints_with_delay_0s/ (allocs/op) N/A 101,211 allocs ✅ New
Send_100_Webhooks_to_10_Endpoints_limiter_with_delay_0s/ (ns/op) N/A 174070.00 ns ✅ New
Send_100_Webhooks_to_10_Endpoints_limiter_with_delay_0s/ (B/op) N/A 128.06 KB ✅ New
Send_100_Webhooks_to_10_Endpoints_limiter_with_delay_0s/ (allocs/op) N/A 1,000 allocs ✅ New
Send_10_Webhooks_to_100_Endpoints_with_delay_0s/ (ns/op) N/A 125.53 ms ✅ New
Send_10_Webhooks_to_100_Endpoints_with_delay_0s/ (B/op) N/A 8.45 MB ✅ New
Send_10_Webhooks_to_100_Endpoints_with_delay_0s/ (allocs/op) N/A 103,333 allocs ✅ New
Send_10_Webhooks_to_100_Endpoints_limiter_with_delay_0s/ (ns/op) N/A 176595.00 ns ✅ New
Send_10_Webhooks_to_100_Endpoints_limiter_with_delay_0s/ (B/op) N/A 128.11 KB ✅ New
Send_10_Webhooks_to_100_Endpoints_limiter_with_delay_0s/ (allocs/op) N/A 1,000 allocs ✅ New
Send_100_Webhooks_to_100_Endpoints_with_delay_0s/ (ns/op) N/A 1.25 s ✅ New
Send_100_Webhooks_to_100_Endpoints_with_delay_0s/ (B/op) N/A 84.06 MB ✅ New
Send_100_Webhooks_to_100_Endpoints_with_delay_0s/ (allocs/op) N/A 1,029,364 allocs ✅ New
Send_100_Webhooks_to_100_Endpoints_limiter_with_delay_0s/ (ns/op) N/A 1.78 ms ✅ New
Send_100_Webhooks_to_100_Endpoints_limiter_with_delay_0s/ (B/op) N/A 1.28 MB ✅ New
Send_100_Webhooks_to_100_Endpoints_limiter_with_delay_0s/ (allocs/op) N/A 10,007 allocs ✅ New
Send_10_Webhooks_to_10_Endpoints_with_delay_10ms/ (ns/op) N/A 116.96 ms ✅ New
Send_10_Webhooks_to_10_Endpoints_with_delay_10ms/ (B/op) N/A 845.04 KB ✅ New
Send_10_Webhooks_to_10_Endpoints_with_delay_10ms/ (allocs/op) N/A 10,299 allocs ✅ New
Send_10_Webhooks_to_10_Endpoints_limiter_with_delay_10ms/ (ns/op) N/A 103.87 ms ✅ New
Send_10_Webhooks_to_10_Endpoints_limiter_with_delay_10ms/ (B/op) N/A 50.53 KB ✅ New
Send_10_Webhooks_to_10_Endpoints_limiter_with_delay_10ms/ (allocs/op) N/A 224 allocs ✅ New
Send_100_Webhooks_to_10_Endpoints_with_delay_10ms/ (ns/op) N/A 1.17 s ✅ New
Send_100_Webhooks_to_10_Endpoints_with_delay_10ms/ (B/op) N/A 8.63 MB ✅ New
Send_100_Webhooks_to_10_Endpoints_with_delay_10ms/ (allocs/op) N/A 102,743 allocs ✅ New
Send_100_Webhooks_to_10_Endpoints_limiter_with_delay_10ms/ (ns/op) N/A 1.04 s ✅ New
Send_100_Webhooks_to_10_Endpoints_limiter_with_delay_10ms/ (B/op) N/A 395.29 KB ✅ New
Send_100_Webhooks_to_10_Endpoints_limiter_with_delay_10ms/ (allocs/op) N/A 2,307 allocs ✅ New
Send_10_Webhooks_to_100_Endpoints_with_delay_10ms/ (ns/op) N/A 233.84 ms ✅ New
Send_10_Webhooks_to_100_Endpoints_with_delay_10ms/ (B/op) N/A 8.67 MB ✅ New
Send_10_Webhooks_to_100_Endpoints_with_delay_10ms/ (allocs/op) N/A 104,565 allocs ✅ New
Send_10_Webhooks_to_100_Endpoints_limiter_with_delay_10ms/ (ns/op) N/A 104.20 ms ✅ New
Send_10_Webhooks_to_100_Endpoints_limiter_with_delay_10ms/ (B/op) N/A 186.03 KB ✅ New
Send_10_Webhooks_to_100_Endpoints_limiter_with_delay_10ms/ (allocs/op) N/A 1,445 allocs ✅ New
Send_100_Webhooks_to_100_Endpoints_with_delay_10ms/ (ns/op) N/A 2.33 s ✅ New
Send_100_Webhooks_to_100_Endpoints_with_delay_10ms/ (B/op) N/A 85.34 MB ✅ New
Send_100_Webhooks_to_100_Endpoints_with_delay_10ms/ (allocs/op) N/A 1,035,247 allocs ✅ New
Send_100_Webhooks_to_100_Endpoints_limiter_with_delay_10ms/ (ns/op) N/A 1.04 s ✅ New
Send_100_Webhooks_to_100_Endpoints_limiter_with_delay_10ms/ (B/op) N/A 1.78 MB ✅ New
Send_100_Webhooks_to_100_Endpoints_limiter_with_delay_10ms/ (allocs/op) N/A 14,442 allocs ✅ New

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 0

♻️ Duplicate comments (8)
pkg/limit/limiter_test.go (8)

253-257: ⚠️ Potential issue

Fix invalid "range over int" usage.

Go does not allow iterating directly over an integer. This code causes a compile error. A typical solution is to iterate from 0 up to numExecute using a standard for loop.

Apply the following diff to fix this loop construct:

-for range numExecute {
+for i := 0; i < numExecute; i++ {
    if lim.Allow("key", callback) {
        callback()
    }
}

272-281: ⚠️ Potential issue

Fix invalid "range over int" usage.

The same issue with ranging over an integer appears here in the concurrent execution test.

Apply the following diff:

-for range numExecute {
+for i := 0; i < numExecute; i++ {
    wg.Add(1)
    go func() {
        defer wg.Done()
        if lim.Allow("key", callback) {
            callback()
        }
    }()
}

298-307: ⚠️ Potential issue

Fix invalid "range over int" usage and variable shadowing.

There are two issues here: ranging over an integer and unnecessary variable shadowing.

Apply the following diff:

-for i := range numExecute {
-    i := i
+for i := 0; i < numExecute; i++ {
     wg.Add(1)
-    go func() {
+    go func(i int) {
         defer wg.Done()
         if lim.Allow(i, callback) {
             callback()
         }
-    }()
+    }(i)
}

328-335: ⚠️ Potential issue

Fix invalid "range over int" usage in two nested loops.

Two instances of ranging over an integer in nested loops.

Apply the following diff:

-for i := range numWindows {
+for i := 0; i < numWindows; i++ {
    callback := func() { o.add(i) }
-    for range numExecute {
+    for j := 0; j < numExecute; j++ {
        if lim.Allow("key", callback) {
            callback()
        }
    }
    time.Sleep(throttleWindow)
}

341-343: ⚠️ Potential issue

Fix invalid "range over int" usage.

Another instance of ranging over an integer.

Apply the following diff:

-for i := range numWindows {
+for i := 0; i < numWindows; i++ {
    assert.Equal(t, i, o.get(i))
}

368-376: ⚠️ Potential issue

Fix invalid "range over int" usage in key creation loop.

Another instance of ranging over an integer.

Apply the following diff:

-for i := range totalKeys {
+for i := 0; i < totalKeys; i++ {
    key := fmt.Sprintf("key-%d", i)
    // Immediate execution.
    if lim.Allow(key, callback) {
        callback()
    }
    // Queue the debounced callback.
    lim.Allow(key, callback)
}

380-383: ⚠️ Potential issue

Fix invalid "range over int" usage in batch verification loop.

Another instance of ranging over an integer.

Apply the following diff:

-for i := range batchNum {
+for i := 0; i < batchNum; i++ {
    assert.Equal(t, totalKeys+expireBatchSize*i, o.len())
    time.Sleep(expireInterval)
}

396-404: ⚠️ Potential issue

Fix invalid "range over int" usage in the second test case.

Another instance of ranging over an integer in the "Force Close Expired" test.

Apply the following diff:

-for i := range totalKeys {
+for i := 0; i < totalKeys; i++ {
    key := fmt.Sprintf("key-%d", i)
    // Immediate execution.
    if lim.Allow(key, callback) {
        callback()
    }
    // Queue the debounced callback.
    lim.Allow(key, callback)
}
🧹 Nitpick comments (2)
test/bench/webhook_bench_test.go (2)

86-121: Consider adding request timeout and retry configuration comments.

The benchmark implementation is solid with proper memory allocation reporting. The client configuration uses fixed values for timeouts and retries, but adding a brief comment explaining the rationale behind these specific values would improve maintainability.


1-164: Add high-level documentation about benchmark methodology and metrics.

While the benchmark implementation is excellent, adding documentation explaining the benchmark methodology, what metrics are being measured, and how to interpret the results would make this file more maintainable and useful for other developers.

@@ -33,6 +33,14 @@ import (
 )
 
+// This file contains benchmarks for webhook sending with and without rate limiting.
+// 
+// The benchmarks measure:
+// - Memory allocations (via b.ReportAllocs())
+// - Execution time for sending webhooks under various conditions
+//
+// We test with different combinations of endpoint counts, webhook counts, and delays
+// to understand performance characteristics under various load scenarios.
+
 // setupWebhookServer simulates an HTTP server for the benchmark.
 func setupWebhookServer(t *testing.B, count int) []*httptest.Server {
 	servers := make([]*httptest.Server, 0, count)
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 48e7f65 and bd7c930.

📒 Files selected for processing (2)
  • pkg/limit/limiter_test.go (1 hunks)
  • test/bench/webhook_bench_test.go (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
test/bench/webhook_bench_test.go (2)
Learnt from: window9u
PR: yorkie-team/yorkie#1166
File: test/bench/webhook_bench_test.go:122-163
Timestamp: 2025-03-12T06:17:36.021Z
Learning: Go 1.22 introduced the ability to use integers directly with `for range` syntax. This allows for code like `for i := range n` to iterate from 0 to n-1, or `for range n` to iterate n times while discarding the index.
Learnt from: window9u
PR: yorkie-team/yorkie#1166
File: test/bench/webhook_bench_test.go:122-163
Timestamp: 2025-03-12T06:17:36.021Z
Learning: Go 1.22+ supports the integer range syntax (`for range n` and `for i := range n`), which is particularly useful for benchmarking code. This allows for more concise iteration over integer values compared to traditional three-clause for loops.
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: build
  • GitHub Check: bench
🔇 Additional comments (7)
pkg/limit/limiter_test.go (4)

1-29: Well-structured test file with proper license and imports.

The file has appropriate Apache License header and imports all necessary packages. The package declaration follows Go's best practices for test files.


31-56: Good implementation of thread-safe helper struct.

The occurs struct properly implements mutex-protected methods for thread-safe operations on a slice. This is important for the concurrent tests in this file.


58-234: Well-designed throttler behavior tests with clear scenarios.

The test cases effectively verify the limiter's core functionality with various event patterns. Each sub-test has descriptive names and appropriate assertions to validate both immediate and deferred execution behaviors.


347-421: Well-implemented batch expiration tests with clear validation.

The batch expiration tests effectively verify that expired entries are processed correctly in batches and validate the behavior during forced closures.

test/bench/webhook_bench_test.go (3)

34-44: Implementation looks good with modern Go loop syntax.

The setupWebhookServer function correctly creates test HTTP servers with proper header verification. The function uses Go 1.22's integer range syntax (for range count), which is a modern and concise approach.


46-84: Well-structured benchmark with comprehensive test scenarios.

The benchmark function provides excellent coverage by testing various combinations of endpoints (10, 100), webhook counts (10, 100), and with/without delays. This approach will give good insights into performance characteristics under different load conditions.


123-164: Well-structured rate-limited benchmark implementation.

The rate-limited benchmark properly utilizes the new Manager to test throttling capabilities. It follows the same structure as the non-limited version but tests the key feature introduced in this PR - the rate-limiting mechanism.

@hackerwins-yorkie hackerwins-yorkie left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Go Benchmark Analysis 📊

This is a comparison result between the previous(68c233b) and the current commit(23ae0ed).

Significant Changes (≥20% difference)

Benchmark suite Previous Current Change
BenchmarkDocument/nested_update_test/ (ns/op) 16818.00 ns 20660.00 ns 🔴 +22.84%

Key Observations 🔍

  • The BenchmarkDocument/nested_update_test/ suite showed a significant increase of +22.84% in the ns/op metric, indicating a notable performance degradation from the previous to the current benchmark.

  • Within the BenchmarkRPC suite, there were both performance improvements and regressions across different benchmarks. Notably, the client_to_client_via_server/ test exhibited a significant increase of +7.85% in execution time, while the client_to_server/ test showed a decrease of -2.68%.

  • In the BenchmarkVersionVector suite, there was a significant increase in execution time for the clients_1000/ benchmark by +4.79%, along with a slight increase in memory consumption. This suggests potential scalability challenges with higher client counts.

  • Several benchmarks, such as those in the BenchmarkSplayTree suite, showed minor improvements in performance ranging from -3.36% to -0.89%, indicating possible optimization enhancements in these areas.

  • There were a few new benchmarks introduced in the BenchmarkWebhook suite, which provided insights into webhooks performance under varying conditions. However, without historical data for comparison, it is challenging to gauge performance changes accurately.

Detailed Test Results

BenchmarkDocument
Benchmark suite Previous Current Change
constructor_test/ (ns/op) 1475.00 ns 1497.00 ns 🔴 +1.49%
constructor_test/ (B/op) 1.43 KB 1.43 KB ⚪ 0%
constructor_test/ (allocs/op) 25 allocs 25 allocs ⚪ 0%
status_test/ (ns/op) 1070.00 ns 1067.00 ns 🟢 -0.28%
status_test/ (B/op) 1.40 KB 1.40 KB ⚪ 0%
status_test/ (allocs/op) 23 allocs 23 allocs ⚪ 0%
equals_test/ (ns/op) 7923.00 ns 7849.00 ns 🟢 -0.93%
equals_test/ (B/op) 7.71 KB 7.71 KB ⚪ 0%
equals_test/ (allocs/op) 132 allocs 132 allocs ⚪ 0%
nested_update_test/ (ns/op) 16818.00 ns 20660.00 ns 🔴 +22.84%
nested_update_test/ (B/op) 12.36 KB 12.36 KB ⚪ 0%
nested_update_test/ (allocs/op) 259 allocs 259 allocs ⚪ 0%
delete_test/ (ns/op) 22897.00 ns 22715.00 ns 🟢 -0.79%
delete_test/ (B/op) 15.84 KB 15.84 KB ⚪ 0%
delete_test/ (allocs/op) 340 allocs 340 allocs ⚪ 0%
object_test/ (ns/op) 8584.00 ns 8473.00 ns 🟢 -1.29%
object_test/ (B/op) 7.08 KB 7.08 KB ⚪ 0%
object_test/ (allocs/op) 119 allocs 119 allocs ⚪ 0%
array_test/ (ns/op) 30978.00 ns 28217.00 ns 🟢 -8.91%
array_test/ (B/op) 12.19 KB 12.19 KB ⚪ 0%
array_test/ (allocs/op) 274 allocs 274 allocs ⚪ 0%
text_test/ (ns/op) 31716.00 ns 31470.00 ns 🟢 -0.78%
text_test/ (B/op) 15.24 KB 15.24 KB ⚪ 0%
text_test/ (allocs/op) 485 allocs 485 allocs ⚪ 0%
text_composition_test/ (ns/op) 31494.00 ns 31810.00 ns 🔴 +1.00%
text_composition_test/ (B/op) 18.75 KB 18.75 KB ⚪ 0%
text_composition_test/ (allocs/op) 502 allocs 502 allocs ⚪ 0%
rich_text_test/ (ns/op) 86630.00 ns 85208.00 ns 🟢 -1.64%
rich_text_test/ (B/op) 39.40 KB 39.40 KB 🔴 +0.01%
rich_text_test/ (allocs/op) 1,147 allocs 1,147 allocs ⚪ 0%
counter_test/ (ns/op) 18162.00 ns 18094.00 ns 🟢 -0.37%
counter_test/ (B/op) 11.86 KB 11.86 KB ⚪ 0%
counter_test/ (allocs/op) 254 allocs 254 allocs ⚪ 0%
text_edit_gc_100/ (ns/op) 1.38 ms 1.39 ms 🔴 +0.40%
text_edit_gc_100/ (B/op) 864.94 KB 864.93 KB ⚪ 0%
text_edit_gc_100/ (allocs/op) 17,282 allocs 17,282 allocs ⚪ 0%
text_edit_gc_1000/ (ns/op) 52.60 ms 52.96 ms 🔴 +0.67%
text_edit_gc_1000/ (B/op) 46.84 MB 46.84 MB ⚪ 0%
text_edit_gc_1000/ (allocs/op) 185,598 allocs 185,604 allocs ⚪ 0%
text_split_gc_100/ (ns/op) 2.10 ms 2.11 ms 🔴 +0.59%
text_split_gc_100/ (B/op) 1.58 MB 1.58 MB ⚪ 0%
text_split_gc_100/ (allocs/op) 15,951 allocs 15,952 allocs ⚪ 0%
text_split_gc_1000/ (ns/op) 127.99 ms 127.98 ms 🟢 -0.01%
text_split_gc_1000/ (B/op) 137.79 MB 137.79 MB ⚪ 0%
text_split_gc_1000/ (allocs/op) 184,982 allocs 184,984 allocs ⚪ 0%
text_delete_all_10000/ (ns/op) 17.22 ms 16.85 ms 🟢 -2.15%
text_delete_all_10000/ (B/op) 10.58 MB 10.58 MB ⚪ 0%
text_delete_all_10000/ (allocs/op) 56,134 allocs 56,136 allocs ⚪ 0%
text_delete_all_100000/ (ns/op) 299.69 ms 287.72 ms 🟢 -3.99%
text_delete_all_100000/ (B/op) 105.53 MB 105.54 MB ⚪ 0%
text_delete_all_100000/ (allocs/op) 566,117 allocs 566,133 allocs ⚪ 0%
text_100/ (ns/op) 246721.00 ns 226636.00 ns 🟢 -8.14%
text_100/ (B/op) 120.95 KB 120.95 KB ⚪ 0%
text_100/ (allocs/op) 5,182 allocs 5,182 allocs ⚪ 0%
text_1000/ (ns/op) 2.56 ms 2.41 ms 🟢 -5.70%
text_1000/ (B/op) 1.16 MB 1.16 MB ⚪ 0%
text_1000/ (allocs/op) 51,085 allocs 51,085 allocs ⚪ 0%
array_1000/ (ns/op) 1.31 ms 1.24 ms 🟢 -5.82%
array_1000/ (B/op) 1.09 MB 1.09 MB ⚪ 0%
array_1000/ (allocs/op) 11,880 allocs 11,880 allocs ⚪ 0%
array_10000/ (ns/op) 13.65 ms 13.26 ms 🟢 -2.82%
array_10000/ (B/op) 9.89 MB 9.89 MB ⚪ 0%
array_10000/ (allocs/op) 120,736 allocs 120,737 allocs ⚪ 0%
array_gc_100/ (ns/op) 138092.00 ns 131297.00 ns 🟢 -4.92%
array_gc_100/ (B/op) 99.93 KB 99.93 KB ⚪ 0%
array_gc_100/ (allocs/op) 1,267 allocs 1,267 allocs ⚪ 0%
array_gc_1000/ (ns/op) 1.48 ms 1.41 ms 🟢 -4.43%
array_gc_1000/ (B/op) 1.14 MB 1.14 MB ⚪ 0%
array_gc_1000/ (allocs/op) 12,927 allocs 12,927 allocs ⚪ 0%
counter_1000/ (ns/op) 213454.00 ns 202930.00 ns 🟢 -4.93%
counter_1000/ (B/op) 178.18 KB 178.19 KB ⚪ 0%
counter_1000/ (allocs/op) 5,772 allocs 5,772 allocs ⚪ 0%
counter_10000/ (ns/op) 2.23 ms 2.15 ms 🟢 -3.34%
counter_10000/ (B/op) 2.07 MB 2.07 MB ⚪ 0%
counter_10000/ (allocs/op) 59,779 allocs 59,779 allocs ⚪ 0%
object_1000/ (ns/op) 1.48 ms 1.38 ms 🟢 -6.24%
object_1000/ (B/op) 1.44 MB 1.44 MB ⚪ 0%
object_1000/ (allocs/op) 9,926 allocs 9,926 allocs ⚪ 0%
object_10000/ (ns/op) 15.34 ms 14.50 ms 🟢 -5.48%
object_10000/ (B/op) 12.35 MB 12.35 MB ⚪ 0%
object_10000/ (allocs/op) 101,234 allocs 101,234 allocs ⚪ 0%
tree_100/ (ns/op) 1.11 ms 1.01 ms 🟢 -8.59%
tree_100/ (B/op) 951.08 KB 951.08 KB ⚪ 0%
tree_100/ (allocs/op) 6,103 allocs 6,103 allocs ⚪ 0%
tree_1000/ (ns/op) 81.61 ms 74.68 ms 🟢 -8.50%
tree_1000/ (B/op) 86.58 MB 86.58 MB ⚪ 0%
tree_1000/ (allocs/op) 60,112 allocs 60,113 allocs ⚪ 0%
tree_10000/ (ns/op) 9.93 s 9.43 s 🟢 -4.98%
tree_10000/ (B/op) 8.58 GB 8.58 GB ⚪ 0%
tree_10000/ (allocs/op) 600,184 allocs 600,167 allocs ⚪ 0%
tree_delete_all_1000/ (ns/op) 83.08 ms 77.66 ms 🟢 -6.52%
tree_delete_all_1000/ (B/op) 87.57 MB 87.57 MB ⚪ 0%
tree_delete_all_1000/ (allocs/op) 75,291 allocs 75,293 allocs ⚪ 0%
tree_edit_gc_100/ (ns/op) 4.08 ms 3.87 ms 🟢 -5.29%
tree_edit_gc_100/ (B/op) 4.15 MB 4.15 MB ⚪ 0%
tree_edit_gc_100/ (allocs/op) 15,147 allocs 15,147 allocs ⚪ 0%
tree_edit_gc_1000/ (ns/op) 341.83 ms 313.11 ms 🟢 -8.40%
tree_edit_gc_1000/ (B/op) 384.05 MB 384.05 MB ⚪ 0%
tree_edit_gc_1000/ (allocs/op) 154,962 allocs 154,952 allocs ⚪ 0%
tree_split_gc_100/ (ns/op) 2.81 ms 2.60 ms 🟢 -7.52%
tree_split_gc_100/ (B/op) 2.41 MB 2.41 MB ⚪ 0%
tree_split_gc_100/ (allocs/op) 11,132 allocs 11,132 allocs ⚪ 0%
tree_split_gc_1000/ (ns/op) 206.54 ms 194.18 ms 🟢 -5.99%
tree_split_gc_1000/ (B/op) 222.50 MB 222.50 MB ⚪ 0%
tree_split_gc_1000/ (allocs/op) 122,064 allocs 122,058 allocs ⚪ 0%
BenchmarkRPC
Benchmark suite Previous Current Change
client_to_server/ (ns/op) 431.30 ms 419.73 ms 🟢 -2.68%
client_to_server/ (B/op) 16.13 MB 16.13 MB 🟢 -0.03%
client_to_server/ (allocs/op) 223,579 allocs 223,549 allocs 🟢 -0.01%
client_to_client_via_server/ (ns/op) 534.17 ms 525.81 ms 🟢 -1.56%
client_to_client_via_server/ (B/op) 26.68 MB 28.77 MB 🔴 +7.85%
client_to_client_via_server/ (allocs/op) 330,511 allocs 332,438 allocs 🔴 +0.58%
attach_large_document/ (ns/op) 1.31 s 1.35 s 🔴 +3.17%
attach_large_document/ (B/op) 1.92 GB 1.91 GB 🟢 -0.53%
attach_large_document/ (allocs/op) 12,347 allocs 12,362 allocs 🔴 +0.12%
adminCli_to_server/ (ns/op) 546.76 ms 547.11 ms 🔴 +0.06%
adminCli_to_server/ (B/op) 21.71 MB 21.31 MB 🟢 -1.86%
adminCli_to_server/ (allocs/op) 316,680 allocs 316,700 allocs ⚪ 0%
BenchmarkLocker
Benchmark suite Previous Current Change
(ns/op) 83.48 ns 84.08 ns 🔴 +0.72%
(B/op) 32.00 B 32.00 B ⚪ 0%
(allocs/op) 1 allocs 1 allocs ⚪ 0%
BenchmarkLockerParallel
Benchmark suite Previous Current Change
(ns/op) 45.35 ns 44.54 ns 🟢 -1.79%
(B/op) 0.00 B 0.00 B ⚪ 0%
(allocs/op) 0 allocs 0 allocs ⚪ 0%
BenchmarkLockerMoreKeys
Benchmark suite Previous Current Change
(ns/op) 174.90 ns 187.40 ns 🔴 +7.15%
(B/op) 31.00 B 30.00 B 🟢 -3.23%
(allocs/op) 0 allocs 0 allocs ⚪ 0%
BenchmarkRWLocker
Benchmark suite Previous Current Change
RWLock_rate_2/ (ns/op) 50.01 ns 48.88 ns 🟢 -2.26%
RWLock_rate_2/ (B/op) 0.00 B 0.00 B ⚪ 0%
RWLock_rate_2/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
RWLock_rate_10/ (ns/op) 43.22 ns 44.62 ns 🔴 +3.24%
RWLock_rate_10/ (B/op) 0.00 B 0.00 B ⚪ 0%
RWLock_rate_10/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
RWLock_rate_100/ (ns/op) 59.21 ns 59.86 ns 🔴 +1.10%
RWLock_rate_100/ (B/op) 2.00 B 2.00 B ⚪ 0%
RWLock_rate_100/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
RWLock_rate_1000/ (ns/op) 87.90 ns 87.38 ns 🟢 -0.59%
RWLock_rate_1000/ (B/op) 8.00 B 8.00 B ⚪ 0%
RWLock_rate_1000/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
BenchmarkChange
Benchmark suite Previous Current Change
Push_10_Changes/ (ns/op) 4.47 ms 4.45 ms 🟢 -0.51%
Push_10_Changes/ (B/op) 150.30 KB 150.46 KB 🔴 +0.11%
Push_10_Changes/ (allocs/op) 1,618 allocs 1,626 allocs 🔴 +0.49%
Push_100_Changes/ (ns/op) 16.21 ms 16.10 ms 🟢 -0.68%
Push_100_Changes/ (B/op) 774.67 KB 773.47 KB 🟢 -0.16%
Push_100_Changes/ (allocs/op) 8,507 allocs 8,512 allocs 🔴 +0.06%
Push_1000_Changes/ (ns/op) 128.55 ms 131.68 ms 🔴 +2.44%
Push_1000_Changes/ (B/op) 7.31 MB 7.20 MB 🟢 -1.44%
Push_1000_Changes/ (allocs/op) 79,323 allocs 79,331 allocs 🔴 +0.01%
Pull_10_Changes/ (ns/op) 3.68 ms 3.67 ms 🟢 -0.34%
Pull_10_Changes/ (B/op) 124.52 KB 124.58 KB 🔴 +0.05%
Pull_10_Changes/ (allocs/op) 1,454 allocs 1,454 allocs ⚪ 0%
Pull_100_Changes/ (ns/op) 5.30 ms 5.31 ms 🔴 +0.22%
Pull_100_Changes/ (B/op) 354.81 KB 354.64 KB 🟢 -0.05%
Pull_100_Changes/ (allocs/op) 5,180 allocs 5,180 allocs ⚪ 0%
Pull_1000_Changes/ (ns/op) 10.80 ms 10.70 ms 🟢 -0.95%
Pull_1000_Changes/ (B/op) 2.20 MB 2.20 MB 🔴 +0.08%
Pull_1000_Changes/ (allocs/op) 44,680 allocs 44,680 allocs ⚪ 0%
BenchmarkSnapshot
Benchmark suite Previous Current Change
Push_3KB_snapshot/ (ns/op) 18.86 ms 19.01 ms 🔴 +0.82%
Push_3KB_snapshot/ (B/op) 890.17 KB 884.73 KB 🟢 -0.61%
Push_3KB_snapshot/ (allocs/op) 8,516 allocs 8,513 allocs 🟢 -0.04%
Push_30KB_snapshot/ (ns/op) 131.38 ms 133.26 ms 🔴 +1.43%
Push_30KB_snapshot/ (B/op) 8.01 MB 7.96 MB 🟢 -0.68%
Push_30KB_snapshot/ (allocs/op) 87,022 allocs 85,972 allocs 🟢 -1.21%
Pull_3KB_snapshot/ (ns/op) 7.32 ms 7.32 ms 🟢 -0.07%
Pull_3KB_snapshot/ (B/op) 1.06 MB 1.06 MB 🔴 +0.07%
Pull_3KB_snapshot/ (allocs/op) 19,259 allocs 19,260 allocs ⚪ 0%
Pull_30KB_snapshot/ (ns/op) 19.44 ms 19.13 ms 🟢 -1.62%
Pull_30KB_snapshot/ (B/op) 8.77 MB 8.77 MB 🔴 +0.08%
Pull_30KB_snapshot/ (allocs/op) 185,673 allocs 185,671 allocs ⚪ 0%
BenchmarkSplayTree
Benchmark suite Previous Current Change
stress_test_100000/ (ns/op) 0.19 ns 0.19 ns 🟢 -1.88%
stress_test_100000/ (B/op) 0.00 B 0.00 B ⚪ 0%
stress_test_100000/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
stress_test_200000/ (ns/op) 0.38 ns 0.38 ns 🟢 -1.23%
stress_test_200000/ (B/op) 0.00 B 0.00 B ⚪ 0%
stress_test_200000/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
stress_test_300000/ (ns/op) 0.61 ns 0.59 ns 🟢 -3.36%
stress_test_300000/ (B/op) 0.00 B 0.00 B ⚪ 0%
stress_test_300000/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
random_access_100000/ (ns/op) 0.01 ns 0.01 ns 🔴 +1.66%
random_access_100000/ (B/op) 0.00 B 0.00 B ⚪ 0%
random_access_100000/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
random_access_200000/ (ns/op) 0.03 ns 0.03 ns 🔴 +3.33%
random_access_200000/ (B/op) 0.00 B 0.00 B ⚪ 0%
random_access_200000/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
random_access_300000/ (ns/op) 0.04 ns 0.04 ns 🟢 -0.89%
random_access_300000/ (B/op) 0.00 B 0.00 B ⚪ 0%
random_access_300000/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
editing_trace_bench/ (ns/op) 0.00 ns 0.00 ns 🟢 -10.06%
editing_trace_bench/ (B/op) 0.00 B 0.00 B ⚪ 0%
editing_trace_bench/ (allocs/op) 0 allocs 0 allocs ⚪ 0%
BenchmarkSync
Benchmark suite Previous Current Change
memory_sync_10_test/ (ns/op) 7278.00 ns 7251.00 ns 🟢 -0.37%
memory_sync_10_test/ (B/op) 1.34 KB 1.34 KB 🔴 +0.07%
memory_sync_10_test/ (allocs/op) 35 allocs 35 allocs ⚪ 0%
memory_sync_100_test/ (ns/op) 55524.00 ns 55169.00 ns 🟢 -0.64%
memory_sync_100_test/ (B/op) 9.51 KB 9.52 KB 🔴 +0.04%
memory_sync_100_test/ (allocs/op) 268 allocs 268 allocs ⚪ 0%
memory_sync_1000_test/ (ns/op) 607648.00 ns 619800.00 ns 🔴 +2.00%
memory_sync_1000_test/ (B/op) 76.60 KB 75.94 KB 🟢 -0.86%
memory_sync_1000_test/ (allocs/op) 2,133 allocs 2,111 allocs 🟢 -1.03%
memory_sync_10000_test/ (ns/op) 7.87 ms 7.88 ms 🔴 +0.07%
memory_sync_10000_test/ (B/op) 753.72 KB 757.64 KB 🔴 +0.52%
memory_sync_10000_test/ (allocs/op) 20,438 allocs 20,469 allocs 🔴 +0.15%
BenchmarkTextEditing
Benchmark suite Previous Current Change
(ns/op) 5.32 s 5.38 s 🔴 +1.22%
(B/op) 3.92 GB 3.92 GB ⚪ 0%
(allocs/op) 20,619,803 allocs 20,620,037 allocs ⚪ 0%
BenchmarkTree
Benchmark suite Previous Current Change
10000_vertices_to_protobuf/ (ns/op) 4.52 ms 4.24 ms 🟢 -6.12%
10000_vertices_to_protobuf/ (B/op) 6.36 MB 6.36 MB ⚪ 0%
10000_vertices_to_protobuf/ (allocs/op) 70,025 allocs 70,025 allocs ⚪ 0%
10000_vertices_from_protobuf/ (ns/op) 228.67 ms 219.87 ms 🟢 -3.85%
10000_vertices_from_protobuf/ (B/op) 442.30 MB 442.31 MB ⚪ 0%
10000_vertices_from_protobuf/ (allocs/op) 290,039 allocs 290,047 allocs ⚪ 0%
20000_vertices_to_protobuf/ (ns/op) 9.47 ms 9.11 ms 🟢 -3.77%
20000_vertices_to_protobuf/ (B/op) 12.89 MB 12.89 MB ⚪ 0%
20000_vertices_to_protobuf/ (allocs/op) 140,028 allocs 140,028 allocs ⚪ 0%
20000_vertices_from_protobuf/ (ns/op) 878.69 ms 885.02 ms 🔴 +0.72%
20000_vertices_from_protobuf/ (B/op) 1.70 GB 1.70 GB ⚪ 0%
20000_vertices_from_protobuf/ (allocs/op) 580,090 allocs 580,083 allocs ⚪ 0%
30000_vertices_to_protobuf/ (ns/op) 13.65 ms 13.77 ms 🔴 +0.88%
30000_vertices_to_protobuf/ (B/op) 18.98 MB 18.98 MB ⚪ 0%
30000_vertices_to_protobuf/ (allocs/op) 210,029 allocs 210,029 allocs ⚪ 0%
30000_vertices_from_protobuf/ (ns/op) 2.09 s 2.03 s 🟢 -2.67%
30000_vertices_from_protobuf/ (B/op) 3.75 GB 3.75 GB ⚪ 0%
30000_vertices_from_protobuf/ (allocs/op) 870,147 allocs 870,240 allocs 🔴 +0.01%
BenchmarkVersionVector
Benchmark suite Previous Current Change
clients_10/ (ns/op) 159.13 ms 160.76 ms 🔴 +1.03%
clients_10/ (1_changepack(bytes)) 745.00 B 745.00 B ⚪ 0%
clients_10/ (2_snapshot(bytes)) 379.00 B 379.00 B ⚪ 0%
clients_10/ (3_pushpull(ms)) 8.00 ms 8.00 ms ⚪ 0%
clients_10/ (4_attach(ms)) 6.00 ms 6.00 ms ⚪ 0%
clients_10/ (5_changepack_after_detach(bytes)) 805.00 B 805.00 B ⚪ 0%
clients_10/ (6_snapshot_after_detach(bytes)) 136.00 B 136.00 B ⚪ 0%
clients_10/ (7_pushpull_after_detach(ms)) 8.00 ms 8.00 ms ⚪ 0%
clients_10/ (B/op) 20.01 MB 18.97 MB 🟢 -5.16%
clients_10/ (allocs/op) 83,228 allocs 83,234 allocs ⚪ 0%
clients_100/ (ns/op) 1.40 s 1.47 s 🔴 +4.54%
clients_100/ (1_changepack(bytes)) 6.14 KB 6.14 KB ⚪ 0%
clients_100/ (2_snapshot(bytes)) 3.08 KB 3.08 KB ⚪ 0%
clients_100/ (3_pushpull(ms)) 11.00 ms 11.00 ms ⚪ 0%
clients_100/ (4_attach(ms)) 9.00 ms 10.00 ms 🔴 +11.11%
clients_100/ (5_changepack_after_detach(bytes)) 6.21 KB 6.21 KB ⚪ 0%
clients_100/ (6_snapshot_after_detach(bytes)) 137.00 B 137.00 B ⚪ 0%
clients_100/ (7_pushpull_after_detach(ms)) 9.00 ms 10.00 ms 🔴 +11.11%
clients_100/ (B/op) 215.15 MB 215.21 MB 🔴 +0.03%
clients_100/ (allocs/op) 1,481,377 allocs 1,481,549 allocs 🔴 +0.01%
clients_1000/ (ns/op) 42.81 s 44.86 s 🔴 +4.79%
clients_1000/ (1_changepack(bytes)) 60.16 KB 60.16 KB ⚪ 0%
clients_1000/ (2_snapshot(bytes)) 30.08 KB 30.08 KB ⚪ 0%
clients_1000/ (3_pushpull(ms)) 114.00 ms 119.00 ms 🔴 +4.39%
clients_1000/ (4_attach(ms)) 72.00 ms 74.00 ms 🔴 +2.78%
clients_1000/ (5_changepack_after_detach(bytes)) 60.22 KB 60.22 KB ⚪ 0%
clients_1000/ (6_snapshot_after_detach(bytes)) 139.00 B 139.00 B ⚪ 0%
clients_1000/ (7_pushpull_after_detach(ms)) 22.00 ms 22.00 ms ⚪ 0%
clients_1000/ (B/op) 6.43 GB 6.43 GB 🟢 -0.02%
clients_1000/ (allocs/op) 93,355,010 allocs 93,355,888 allocs ⚪ 0%
BenchmarkWebhook
Benchmark suite Previous Current Change
Send_10_Webhooks_to_10_Endpoints_with_delay_0s/ (ns/op) N/A 12.29 ms ✅ New
Send_10_Webhooks_to_10_Endpoints_with_delay_0s/ (B/op) N/A 809.28 KB ✅ New
Send_10_Webhooks_to_10_Endpoints_with_delay_0s/ (allocs/op) N/A 10,116 allocs ✅ New
Send_10_Webhooks_to_10_Endpoints_limiter_with_delay_0s/ (ns/op) N/A 17876.00 ns ✅ New
Send_10_Webhooks_to_10_Endpoints_limiter_with_delay_0s/ (B/op) N/A 12.80 KB ✅ New
Send_10_Webhooks_to_10_Endpoints_limiter_with_delay_0s/ (allocs/op) N/A 100 allocs ✅ New
Send_100_Webhooks_to_10_Endpoints_with_delay_0s/ (ns/op) N/A 123.31 ms ✅ New
Send_100_Webhooks_to_10_Endpoints_with_delay_0s/ (B/op) N/A 8.10 MB ✅ New
Send_100_Webhooks_to_10_Endpoints_with_delay_0s/ (allocs/op) N/A 101,206 allocs ✅ New
Send_100_Webhooks_to_10_Endpoints_limiter_with_delay_0s/ (ns/op) N/A 181405.00 ns ✅ New
Send_100_Webhooks_to_10_Endpoints_limiter_with_delay_0s/ (B/op) N/A 128.06 KB ✅ New
Send_100_Webhooks_to_10_Endpoints_limiter_with_delay_0s/ (allocs/op) N/A 1,000 allocs ✅ New
Send_10_Webhooks_to_100_Endpoints_with_delay_0s/ (ns/op) N/A 132.46 ms ✅ New
Send_10_Webhooks_to_100_Endpoints_with_delay_0s/ (B/op) N/A 8.43 MB ✅ New
Send_10_Webhooks_to_100_Endpoints_with_delay_0s/ (allocs/op) N/A 103,204 allocs ✅ New
Send_10_Webhooks_to_100_Endpoints_limiter_with_delay_0s/ (ns/op) N/A 184746.00 ns ✅ New
Send_10_Webhooks_to_100_Endpoints_limiter_with_delay_0s/ (B/op) N/A 128.09 KB ✅ New
Send_10_Webhooks_to_100_Endpoints_limiter_with_delay_0s/ (allocs/op) N/A 1,000 allocs ✅ New
Send_100_Webhooks_to_100_Endpoints_with_delay_0s/ (ns/op) N/A 1.32 s ✅ New
Send_100_Webhooks_to_100_Endpoints_with_delay_0s/ (B/op) N/A 84.07 MB ✅ New
Send_100_Webhooks_to_100_Endpoints_with_delay_0s/ (allocs/op) N/A 1,029,438 allocs ✅ New
Send_100_Webhooks_to_100_Endpoints_limiter_with_delay_0s/ (ns/op) N/A 1.87 ms ✅ New
Send_100_Webhooks_to_100_Endpoints_limiter_with_delay_0s/ (B/op) N/A 1.28 MB ✅ New
Send_100_Webhooks_to_100_Endpoints_limiter_with_delay_0s/ (allocs/op) N/A 10,007 allocs ✅ New
Send_10_Webhooks_to_10_Endpoints_with_delay_10ms/ (ns/op) N/A 117.21 ms ✅ New
Send_10_Webhooks_to_10_Endpoints_with_delay_10ms/ (B/op) N/A 847.54 KB ✅ New
Send_10_Webhooks_to_10_Endpoints_with_delay_10ms/ (allocs/op) N/A 10,296 allocs ✅ New
Send_10_Webhooks_to_10_Endpoints_limiter_with_delay_10ms/ (ns/op) N/A 103.44 ms ✅ New
Send_10_Webhooks_to_10_Endpoints_limiter_with_delay_10ms/ (B/op) N/A 47.23 KB ✅ New
Send_10_Webhooks_to_10_Endpoints_limiter_with_delay_10ms/ (allocs/op) N/A 223 allocs ✅ New
Send_100_Webhooks_to_10_Endpoints_with_delay_10ms/ (ns/op) N/A 1.17 s ✅ New
Send_100_Webhooks_to_10_Endpoints_with_delay_10ms/ (B/op) N/A 8.51 MB ✅ New
Send_100_Webhooks_to_10_Endpoints_with_delay_10ms/ (allocs/op) N/A 102,688 allocs ✅ New
Send_100_Webhooks_to_10_Endpoints_limiter_with_delay_10ms/ (ns/op) N/A 1.04 s ✅ New
Send_100_Webhooks_to_10_Endpoints_limiter_with_delay_10ms/ (B/op) N/A 388.68 KB ✅ New
Send_100_Webhooks_to_10_Endpoints_limiter_with_delay_10ms/ (allocs/op) N/A 2,221 allocs ✅ New
Send_10_Webhooks_to_100_Endpoints_with_delay_10ms/ (ns/op) N/A 242.27 ms ✅ New
Send_10_Webhooks_to_100_Endpoints_with_delay_10ms/ (B/op) N/A 8.66 MB ✅ New
Send_10_Webhooks_to_100_Endpoints_with_delay_10ms/ (allocs/op) N/A 104,556 allocs ✅ New
Send_10_Webhooks_to_100_Endpoints_limiter_with_delay_10ms/ (ns/op) N/A 104.04 ms ✅ New
Send_10_Webhooks_to_100_Endpoints_limiter_with_delay_10ms/ (B/op) N/A 185.71 KB ✅ New
Send_10_Webhooks_to_100_Endpoints_limiter_with_delay_10ms/ (allocs/op) N/A 1,443 allocs ✅ New
Send_100_Webhooks_to_100_Endpoints_with_delay_10ms/ (ns/op) N/A 2.39 s ✅ New
Send_100_Webhooks_to_100_Endpoints_with_delay_10ms/ (B/op) N/A 85.34 MB ✅ New
Send_100_Webhooks_to_100_Endpoints_with_delay_10ms/ (allocs/op) N/A 1,035,175 allocs ✅ New
Send_100_Webhooks_to_100_Endpoints_limiter_with_delay_10ms/ (ns/op) N/A 1.04 s ✅ New
Send_100_Webhooks_to_100_Endpoints_limiter_with_delay_10ms/ (B/op) N/A 1.78 MB ✅ New
Send_100_Webhooks_to_100_Endpoints_limiter_with_delay_10ms/ (allocs/op) N/A 14,448 allocs ✅ New

@hackerwins hackerwins changed the title Introduce Event Timing Control Package with Throttling and Debouncing Mechanism Introduce EventTimingControl Package with Throttling and Debouncing Mar 12, 2025

@hackerwins hackerwins left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for your contribution.

@hackerwins hackerwins merged commit 47f0d50 into main Mar 12, 2025
@hackerwins hackerwins deleted the rate-limiter branch March 12, 2025 08:50
hackerwins pushed a commit that referenced this pull request Mar 12, 2025
…1166)

Added a new rate-limiter component that implements both throttling and
debouncing mechanisms to control event timing and execution frequency.

Key behaviors:
- **Immediate Execution**: Executes the callback immediately if allowed by
  the rate limiter.
- **Delayed Execution**: If a token is unavailable, blocks until the next
  token is available, then executes the callback.
- **Debouncing**: Prevents scheduling multiple callbacks if one is already
  pending, ensuring that the final event's callback is eventually executed.
hackerwins pushed a commit that referenced this pull request Mar 12, 2025
Added a new rate-limiter component that implements both throttling and
debouncing mechanisms to control event timing and execution frequency.

Key behaviors:
- **Immediate Execution**: Executes the callback immediately if allowed by
  the rate limiter.
- **Delayed Execution**: If a token is unavailable, blocks until the next
  token is available, then executes the callback.
- **Debouncing**: Prevents scheduling multiple callbacks if one is already
  pending, ensuring that the final event's callback is eventually executed.
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.

3 participants