Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fileget: allocate a slice with enough capacity
so a copy is not needed in MarshalBinary and sendPacket. Here are some profiling results while downloading a file, before this patch: 1254.24MB 55.18% 55.18% 1254.24MB 55.18% github.com/pkg/sftp.sshFxpDataPacket.MarshalBinary 991.81MB 43.63% 98.81% 991.81MB 43.63% github.com/pkg/sftp.fileget 1MB 0.044% 98.86% 1255.24MB 55.22% github.com/pkg/sftp.(*packetManager).maybeSendPackets 0.50MB 0.022% 98.88% 1260.24MB 55.44% github.com/pkg/sftp.(*packetManager).controller 0 0% 98.88% 991.81MB 43.63% github.com/pkg/sftp.(*Request).call 0 0% 98.88% 993.31MB 43.70% github.com/pkg/sftp.(*RequestServer).Serve.func1.1 0 0% 98.88% 993.31MB 43.70% github.com/pkg/sftp.(*RequestServer).packetWorker 0 0% 98.88% 1254.24MB 55.18% github.com/pkg/sftp.(*conn).sendPacket 0 0% 98.88% 1254.24MB 55.18% github.com/pkg/sftp.sendPacket with this patch: 1209.48MB 98.46% 98.46% 1209.48MB 98.46% github.com/pkg/sftp.fileget 2MB 0.16% 98.63% 7.50MB 0.61% github.com/pkg/sftp.recvPacket 0 0% 98.63% 8MB 0.65% github.com/drakkan/sftpgo/sftpd.Configuration.handleSftpConnection 0 0% 98.63% 1209.48MB 98.46% github.com/pkg/sftp.(*Request).call 0 0% 98.63% 8MB 0.65% github.com/pkg/sftp.(*RequestServer).Serve 0 0% 98.63% 1209.98MB 98.50% github.com/pkg/sftp.(*RequestServer).Serve.func1.1 0 0% 98.63% 1209.98MB 98.50% github.com/pkg/sftp.(*RequestServer).packetWorker 0 0% 98.63% 7.50MB 0.61% github.com/pkg/sftp.(*conn).recvPacket (inline)
- Loading branch information