-
Notifications
You must be signed in to change notification settings - Fork 152
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
Boost PreloadAsync() #420
Boost PreloadAsync() #420
Conversation
6d0e141
to
9bba9ab
Compare
4049d43
to
00197ca
Compare
13b17c5
to
f08577b
Compare
f08577b
to
fc4bb70
Compare
I've rebased. PTAL. |
Codecov Report
@@ Coverage Diff @@
## master #420 +/- ##
=========================================
+ Coverage 87.97% 88% +0.03%
=========================================
Files 195 195
Lines 13675 13729 +54
=========================================
+ Hits 12030 12082 +52
- Misses 1332 1334 +2
Partials 313 313
|
fc4bb70
to
c111e56
Compare
I've rebased to append it to 0.6.0. |
c111e56
to
b46fb2c
Compare
@@ -53,6 +53,26 @@ public interface IStore | |||
|
|||
bool DeleteIndex(string @namespace, HashDigest<SHA256> hash); | |||
|
|||
/// <summary> | |||
/// Forks block indexes from |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the term “block indexes” mean a sequence (chain) of block hashes and its index numbers? Or does it include state references? If it's latter the plural term seems natural for me as well, but if it's former I believe the singular term (i.e., “block index”) would listen more natural IMHO (as like the way other related methods are named, e.g., AppendIndex
, DeleteIndex
, IterateIndex
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's former. but I've confused about that because….
AppendIndex()
andDeleteIndex()
take only one argument.- Other iteration methods use plural form. (e.g.
IterateBlockHashes()
,IterateStateReferences()
)
So, how about keep ForkIndexes()
in this PR and rename IterateIndex()
to IterateIndexes()
in other PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO in the case of this a singular noun “index” is more natural than a plural noun “indexes”/“indices,” in the same manner we say “a set of blocks” instead of “sets of blocks” to mean ISet[Block]
in verbal language.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought about this terminology once more, and it turns out the plural term has its own advantage, and I agree your suggestion to rename these method names to use the plural term “indexes” instead of the singular “index.” Some reasons:
- Although relational databases tend to say “an index” for values in a column, we also say “indices” in books.
- We already name a block's height by
Block.Index
, so it's natural to say a collection ofBlock.Index
es as the plural “indexes.”
b46fb2c
to
eb59e7c
Compare
- Use temporary memory to organize staterefs for avoid too many file writings - IStore.StoreStateReferences() became to take blockHash and blockIndex instead of the block itself. - Remove ReceivedAddress from StateReferenceDownloadState
- Add ForkBlockIndexes to IStore and LiteDBStore for fast fork
eb59e7c
to
2d81e58
Compare
…bump-submodule Bump submodule
This patch enhances the performance of
Swarm.PreloadAsync()
using two tricks as below.RecentStates.StateReferences
directly,PreloadAsync
became to translate this message asDictionary<HashDigest<SHA256>, ISet<Address>>
to reduce file I/O.IStore.StoreStateReference
became to takeblockHash
andblockIndex
, not wholeBlock
.PreloadAsync()
are currently fork its chain to prevent corruption by unexpected termination. this patch reduces its file I/O byIStore.ForkIndexes()