near / nearcore

Reference client for NEAR Protocol
https://near.org
GNU General Public License v3.0
2.31k stars 618 forks source link

Use Box for large enums #1313

Open evgenykuzyakov opened 5 years ago

evgenykuzyakov commented 5 years ago

Once borsh supports Box serialization, we should switch to it: https://github.com/nearprotocol/borsh/issues/19

Enums preallocate memory for the largest item. For example the same enum (e.g. PeerMessage) contains Handshake and Block or ChunkOnePart. Handshake enum value will have the same fixed memory size as the largest item

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity in the last 2 months. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

Rishabhraghwendra18 commented 2 years ago

@pmnoxx is this issue resolved ?

pmnoxx commented 2 years ago

@Rishabhraghwendra18 More work is required. I have a script, which prints all places where this issue happens.

Rishabhraghwendra18 commented 2 years ago

Ok.. no problem @pmnoxx . I will find some other issue to work on

pmnoxx commented 2 years ago

@Rishabhraghwendra18 I started working on fixing it for near-network. https://github.com/near/nearcore/pull/5834 The issue is a bit complicated, as some other code changes / refactoring are required. I don't think it's a good issue to start with.