-
Notifications
You must be signed in to change notification settings - Fork 860
feat: add live state LtHash library #2647
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2647 +/- ##
==========================================
+ Coverage 43.71% 43.78% +0.06%
==========================================
Files 1902 1904 +2
Lines 158679 158932 +253
==========================================
+ Hits 69372 69587 +215
- Misses 82918 82941 +23
- Partials 6389 6404 +15
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
|
||
| // computeDelta computes the LtHash delta for a changeset. | ||
| func computeDelta(kvPairs []KVPairWithLastValue, numWorkers int) (*LtHash, *LtHashTimings) { | ||
| totalStart := time.Now() |
Check warning
Code scanning / CodeQL
Calling the system time Warning
| } | ||
|
|
||
| // Phase 1: Serialize | ||
| serializeStart := time.Now() |
Check warning
Code scanning / CodeQL
Calling the system time Warning
| serializeNs := time.Since(serializeStart).Nanoseconds() | ||
|
|
||
| // Phase 2: Hash (parallel) | ||
| blake3Start := time.Now() |
Check warning
Code scanning / CodeQL
Calling the system time Warning
| blake3Ns := time.Since(blake3Start).Nanoseconds() | ||
|
|
||
| // Phase 3: MixIn/MixOut (parallel) | ||
| mixStart := time.Now() |
Check warning
Code scanning / CodeQL
Calling the system time Warning
| mixNs := time.Since(mixStart).Nanoseconds() | ||
|
|
||
| // Phase 4: Merge | ||
| mergeStart := time.Now() |
Check warning
Code scanning / CodeQL
Calling the system time Warning
| serializeNs := time.Since(serializeStart).Nanoseconds() | ||
|
|
||
| // Phase 2: Hash | ||
| blake3Start := time.Now() |
Check warning
Code scanning / CodeQL
Calling the system time Warning
| blake3Ns := time.Since(blake3Start).Nanoseconds() | ||
|
|
||
| // Phase 3: MixIn/MixOut | ||
| mixStart := time.Now() |
Check warning
Code scanning / CodeQL
Calling the system time Warning
| package lthash | ||
|
|
||
| import ( | ||
| "runtime" |
Check notice
Code scanning / CodeQL
Sensitive package import Note
| go func(startIdx, endIdx int) { | ||
| defer wg.Done() | ||
| for i := startIdx; i < endIdx; i++ { | ||
| skv := serializedPairs[i] | ||
| if skv.lastSerialized != nil { | ||
| lthashPairs[i].lastLth = hash(skv.lastSerialized) | ||
| } | ||
| if skv.newSerialized != nil { | ||
| lthashPairs[i].newLth = hash(skv.newSerialized) | ||
| } | ||
| } | ||
| }(start, end) |
Check notice
Code scanning / CodeQL
Spawning a Go routine Note
| go func(workerID int, startIdx, endIdx int) { | ||
| defer wg.Done() | ||
| workerLth := getLtHashFromPool() | ||
| for i := startIdx; i < endIdx; i++ { | ||
| lp := lthashPairs[i] | ||
| if lp.lastLth != nil { | ||
| workerLth.MixOut(lp.lastLth) | ||
| putLtHashToPool(lp.lastLth) | ||
| } | ||
| if lp.newLth != nil { | ||
| workerLth.MixIn(lp.newLth) | ||
| putLtHashToPool(lp.newLth) | ||
| } | ||
| } | ||
| results[workerID] = workerLth | ||
| }(w, start, end) |
Check notice
Code scanning / CodeQL
Spawning a Go routine Note
Describe your changes and provide context
Testing performed to validate your change