-
-
Notifications
You must be signed in to change notification settings - Fork 886
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
Implement parallel download #945
Conversation
So, basically, you're doing to Overall, I like the idea but I think the implementation is a little wonky. For example, $possible_packet_sizes = array($this->max_sftp_packet, $size);
if ($limit - $read > 0) {
$possible_packet_sizes[] = $limit - $read;
}
$packet_size = min($possible_packet_sizes); I think this would be better: $packet_size = $length > 0 ? min($this->max_sftp_packet, $length - $read) : $this->max_sftp_packet; With that if ($length > 0 && $length <= $offset - $start) {
if ($local_file === false) {
$content = substr($content, 0, $length);
} else {
ftruncate($fp, $length + $res_offset);
}
} With your changes the Give me a few days to review this in more depth. Thanks! |
Well, it is the other way around, the modified function is
$limit is also used to prevent unnecessary requests if enough for the desired amount of data have already been sent. Also, do you think it is a good idea to add one more argument to the Thanks :) |
Hi, I just wanted to let you know that I made some changes, because I had issues with the previous implementation. I changed this section a little
but I fear that by using |
Well $request_id_offset = 5;// just like that, a random number idk why you're doing this. I mean, sure, I could see some benefit if you were worried about getting responses in a non-sequential order, but you're not checking for that. As is it seems that all you're doing is using it to keep track of how many while (!$break_loop) { Why not do |
Regarding the
No particular reason, both approaches look the same to me. If I am to do I'll do the suggested changes today. Thanks for the help! |
Hi, I just wanted to let you know that there is a memory leak when transferring thousands of small files. I think I fixed it and I am now testing. If everything goes well I will do 1 more commit later today, or tomorrow. |
I pushed the changes. The memory leak seems fixed now. |
I apologize for the tardyness of this response - I've been busy moving. Anyway, this has been merged. I did make a few tweaks.
Thanks! |
the code that's being removed has its origins in 65193d9. in that commit the packet length is set outside of the while loop. this would continue to be the case until phpseclib#945.
the code that's being removed has its origins in 65193d9. in that commit the packet length is set outside of the while loop. this would continue to be the case until phpseclib#945.
the code that's being removed has its origins in 65193d9. in that commit the packet length is set outside of the while loop. this would continue to be the case until phpseclib#945.
This may be completely wrong implementation, but it worked in my tests. It sped up the download from ~400 Kb/s to ~12 Mb/s.