Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upOptimization: don't re-verify unchanged files #715
Merged
Conversation
Let the user specify known-good file modtimes. If the files modtime is at least that old, then the file hasn't changed and does not need to be re-verified. This is only valid in node when using FS backing storage, not in the browser
| return fileModtimes[index] === self._fileModtimes[index] | ||
| }).reduce(function (a, b) { | ||
| return a && b | ||
| }) |
This comment has been minimized.
This comment has been minimized.
feross
Apr 2, 2016
Member
This will probably crash when there's only one file, since a default starting value was not specified for reduce.
This comment has been minimized.
This comment has been minimized.
| @@ -5,12 +5,12 @@ module.exports = Torrent | |||
| var addrToIPPort = require('addr-to-ip-port') | |||
| var BitField = require('bitfield') | |||
| var ChunkStoreWriteStream = require('chunk-store-stream/write') | |||
| var cpus = require('cpus') | |||
This comment has been minimized.
This comment has been minimized.
| @@ -45,6 +45,8 @@ var PIPELINE_MAX_DURATION = 1 | |||
| var RECHOKE_INTERVAL = 10000 // 10 seconds | |||
| var RECHOKE_OPTIMISTIC_DURATION = 2 // 30 seconds | |||
|
|
|||
| var FILESYSTEM_CONCURRENCY = 2 | |||
This comment has been minimized.
This comment has been minimized.
| for (var index = 0; index < self.pieces.length; index++) { | ||
| self._markVerified(index) | ||
| } | ||
| self._onStore() |
This comment has been minimized.
This comment has been minimized.
feross
Apr 2, 2016
Member
This could be optimized further to handle the case where only some files are modified, i.e. mark pieces that are wholly-contained within unchanged files as verified, and reverify the rest.
This comment has been minimized.
This comment has been minimized.
|
Thanks for the PR, @dcposch! Looks great. |
feross
added a commit
that referenced
this pull request
Apr 6, 2016
This comment has been minimized.
This comment has been minimized.
lock
bot
commented
May 4, 2018
|
This thread has been automatically locked because it has not had recent activity. To discuss futher, please open a new issue. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
dcposch commentedApr 2, 2016
Let the user specify known-good file modtimes. If the files modtime is at least
that old, then the file hasn't changed and does not need to be re-verified.
This is only valid in node when using FS backing storage, not in the browser