mirror of https://github.com/vacp2p/nim-libp2p.git
e285d8bbf4
In `async` functions, a closure environment is created for variables that cross an await boundary - this closure environment is kept in memory for the lifetime of the associated future - this means that although _some_ variables are no longer used, they still take up memory for a long time. In Nimbus, message validation is processed in batches meaning the future of an incoming gossip message stays around for quite a while - this leads to memory consumption peaks of 100-200 mb when there are many attestations in the pipeline. To avoid excessive memory usage, it's generally better to move non-async code into proc's such that the variables therein can be released earlier - this includes the many hidden variables introduced by macro and template expansion (ie chronicles that does expensive exception handling) * move seen table salt to floodsub, use there as well * shorten seen table salt to size of hash * avoid unnecessary memory allocations and copies in a few places * factor out message scoring * avoid reencoding outgoing message for every peer * keep checking validators until reject (in case there's both reject and ignore) * `readOnce` avoids `readExactly` overhead for single-byte read * genericAssign -> assign2 |
||
---|---|---|
.. | ||
pubsub | ||
helpers.nim | ||
nim.cfg | ||
testbufferstream.nim | ||
testcid.nim | ||
testconnection.nim | ||
testconnmngr.nim | ||
testcrypto.nim | ||
testdaemon.nim | ||
testecnist.nim | ||
tested25519.nim | ||
testidentify.nim | ||
testinterop.nim | ||
testminasn1.nim | ||
testminprotobuf.nim | ||
testmplex.nim | ||
testmultiaddress.nim | ||
testmultibase.nim | ||
testmultihash.nim | ||
testmultistream.nim | ||
testnative.nim | ||
testnoise.nim | ||
testpeerid.nim | ||
testpeerinfo.nim | ||
testpeerstore.nim | ||
testpkifilter.nim | ||
testrsa.nim | ||
testsecp256k1.nim | ||
testsemaphore.nim | ||
teststreamseq.nim | ||
testswitch.nim | ||
testtransport.nim | ||
testvarint.nim |