Skip to content
This repository has been archived by the owner on Feb 1, 2023. It is now read-only.

Reduce memory allocation #103

Merged
merged 1 commit into from
Mar 28, 2019
Merged

Conversation

bpot
Copy link
Contributor

@bpot bpot commented Mar 27, 2019

This reverts commit fc1278e.

It appears that using a buffer here is no longer necessary after the
upstream fix gogo/protobuf#504

The bufio.NewWriter looks to be responsible for nearly half the allocations (by size) on a heavily loaded ipfs daemon:

(pprof) peek msgToStream
Showing nodes accounting for 193647.89MB, 100% of 193647.89MB total
----------------------------------------------------------+-------------
      flat  flat%   sum%        cum   cum%   calls calls% + context 	 	 
----------------------------------------------------------+-------------
                                        92608.33MB   100% |   gx/ipfs/QmcSPuzpSbVLU6UHU4e5PwZpm4fHbCn5SbNR5ZNL6Mj63G/go-bitswap/network.(*streamMessageSender).SendMsg
                                            7.47MB 0.0081% |   gx/ipfs/QmcSPuzpSbVLU6UHU4e5PwZpm4fHbCn5SbNR5ZNL6Mj63G/go-bitswap/network.(*impl).SendMessage
         0     0%     0% 92615.80MB 47.83%                | gx/ipfs/QmcSPuzpSbVLU6UHU4e5PwZpm4fHbCn5SbNR5ZNL6Mj63G/go-bitswap/network.msgToStream
                                        80303.55MB 86.71% |   bufio.NewWriter
                                         8285.02MB  8.95% |   gx/ipfs/QmcSPuzpSbVLU6UHU4e5PwZpm4fHbCn5SbNR5ZNL6Mj63G/go-bitswap/message.(*impl).ToNetV1
                                         2802.69MB  3.03% |   bufio.(*Writer).Flush
                                         1216.04MB  1.31% |   gx/ipfs/Qma3Xp3FXFSP4prirEiRYHJ2tgGE8EAx9i6JLziPLpAQjq/go-libp2p-swarm.(*Stream).SetWriteDeadline
                                            8.50MB 0.0092% |   gx/ipfs/QmcSPuzpSbVLU6UHU4e5PwZpm4fHbCn5SbNR5ZNL6Mj63G/go-bitswap/message.(*impl).ToNetV0

This reverts commit fc1278e.

It appears that using a buffer here is no longer necessary after the
upstream fix gogo/protobuf#504
@Stebalien Stebalien merged commit 088fd5f into ipfs:master Mar 28, 2019
@Stebalien
Copy link
Member

Thanks!

Jorropo pushed a commit to Jorropo/go-libipfs that referenced this pull request Jan 26, 2023
…rite

Reduce memory allocation

This commit was moved from ipfs/go-bitswap@088fd5f
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants