Skip to content

Conversation

@frrist
Copy link
Member

@frrist frrist commented Apr 28, 2022

Why

Explored idea in #62 with bench-marking and was able to achieve a 2-3x speed up (bitwidth of 5-6) vs serial diffing. Furthermore #62 was used in a test branch of lily filecoin-project/lily#880 where we observed a significant speed up (from mins to milliseconds) in its processing pipeline (diffing actor states, state-trees, miner and market AMTs).

What

parallelDiffNode is mostly a copy of diffNode with the addition of an errgroup to parallelize recursive access. parallelDiffNode is called from within diffAndAssertLength for all tests.

@codecov-commenter
Copy link

codecov-commenter commented Apr 28, 2022

Codecov Report

Merging #67 (742d422) into master (267d1e7) will increase coverage by 3.65%.
The diff coverage is 75.22%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #67      +/-   ##
==========================================
+ Coverage   60.94%   64.60%   +3.65%     
==========================================
  Files           8        9       +1     
  Lines         973     1308     +335     
==========================================
+ Hits          593      845     +252     
- Misses        257      313      +56     
- Partials      123      150      +27     
Impacted Files Coverage Δ
diff_parallel.go 75.22% <75.22%> (ø)

@frrist frrist marked this pull request as draft April 28, 2022 02:18
@frrist frrist force-pushed the frrist/parallel-diff branch from aec3477 to 781fdc5 Compare April 28, 2022 02:20
@frrist frrist mentioned this pull request Apr 28, 2022
@frrist frrist self-assigned this Apr 28, 2022
@frrist frrist added the enhancement New feature or request label Apr 28, 2022

type mockBlocks struct {
data map[cid.Cid]block.Block
dataMu sync.Mutex
Copy link
Member Author

Choose a reason for hiding this comment

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

required to prevent race condition in test since ParallelDiff accesses the store in parallel

@frrist frrist marked this pull request as ready for review April 28, 2022 02:28
@frrist frrist marked this pull request as draft April 28, 2022 16:04
@frrist frrist force-pushed the frrist/parallel-diff branch from 781fdc5 to eb347a2 Compare May 4, 2022 18:32
@frrist frrist marked this pull request as ready for review May 5, 2022 20:12
@frrist frrist requested a review from Stebalien May 5, 2022 20:12
@frrist frrist merged commit 1e3e6c6 into master May 6, 2022
@frrist frrist deleted the frrist/parallel-diff branch May 6, 2022 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants