jd / jd/fastcounter

Idea: Fast Write Counter to Use Two Counters

Open
#2 1 comment 2 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
40
Forks
7
PR merge metrics
No merged PRs in 30d

Description

Hi there, read our blog post and came here to review the code. Thanks for the writeup and sharing.

Here’s the idea: what if the Fast Write Counter used two counters: one for writes and one for reads. For writers, just increment the writer counter. But for reads, increment both the writer and reader counters. Then subtract the write count from the read count.

The benefit of the design is no locks. The drawback is that the count is no longer precise (there exists a race between the two locks). But it’s probably close enough.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.