nearcore icon indicating copy to clipboard operation
nearcore copied to clipboard

Use Box for large enums

Open evgenykuzyakov opened this issue 5 years ago • 5 comments

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

evgenykuzyakov avatar Sep 14 '19 00:09 evgenykuzyakov

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.

stale[bot] avatar Jul 01 '21 12:07 stale[bot]

@pmnoxx is this issue resolved ?

Rishabhraghwendra18 avatar Dec 15 '21 04:12 Rishabhraghwendra18

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

pmnoxx avatar Dec 15 '21 06:12 pmnoxx

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

Rishabhraghwendra18 avatar Dec 16 '21 03:12 Rishabhraghwendra18

@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.

pmnoxx avatar Dec 16 '21 03:12 pmnoxx