Chia-Network / clvm_rs

Rust implementation of clvm
Apache License 2.0
66 stars 57 forks source link

`NodePtr` internal representation #359

Closed arvidn closed 9 months ago

arvidn commented 9 months ago

This patch changes the internal representation of NodePtr to use the top 6 bits as "type" and the bottom 26 bits for "index". Currently we use positive numbers for atoms and negative numbers for pairs. The new representation supports more types.

For example, we may want to have atoms in BigInt, G1 or G2 formats internally. These could be new types.

But perhaps the most important optimization this opens up is to have atoms point to external buffers. e.g. when running a program stored in a buffer, we could have atoms point directly into that buffer rather than copying everything into the Allocator object first.

coveralls-official[bot] commented 9 months ago

Pull Request Test Coverage Report for Build 7451991707


Totals Coverage Status
Change from base Build 7446887251: -0.1%
Covered Lines: 5437
Relevant Lines: 5803

💛 - Coveralls