Skip to content

Commit 46b4884

Browse files
committed
comments
1 parent 23f3483 commit 46b4884

3 files changed

Lines changed: 6 additions & 2 deletions

File tree

barretenberg/cpp/src/barretenberg/vm2/simulation/lib/serialization.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ namespace bb::avm2::simulation {
1515
class Operand {
1616
private:
1717
// We use unique ptrs to bound the size of the Operand class to the size of a pointer.
18+
// FIXME: Not true! Sadly the variant is sizeof(ptr) + 1 = 8 + 1, but it's aligned,
19+
// so it's 16 bytes which wastes 7 bytes. Still better than 32 + 1 + padding = 40 bytes,
20+
// but worth it?
1821
using FieldInHeap = std::unique_ptr<FF>;
1922
using U128InHeap = std::unique_ptr<uint128_t>;
2023
using Variant = std::variant<uint8_t, uint16_t, uint32_t, uint64_t, FieldInHeap, U128InHeap>;

barretenberg/cpp/src/barretenberg/vm2/tracegen/lib/lookup_builder.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99

1010
namespace bb::avm2::tracegen {
1111

12-
// TODO: This builds the counts. Think if it should do more or change name.
13-
1412
template <typename LookupSettings_> class BaseLookupTraceBuilder {
1513
public:
1614
virtual ~BaseLookupTraceBuilder() = default;

barretenberg/cpp/src/barretenberg/vm2/tracegen/trace_container.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ class TraceContainer {
5757
std::shared_mutex mutex;
5858
uint32_t max_row_number = 0;
5959
bool row_number_dirty; // needs recalculation
60+
// Future memory optimization notes: we can do the same trick as in Operand.
61+
// That is, store a variant with a unique_ptr. However, we should benchmark this.
62+
// (see serialization.hpp).
6063
unordered_flat_map<uint32_t, FF> rows;
6164
};
6265
static constexpr size_t NUM_COLUMNS = static_cast<size_t>(ColumnAndShifts::NUM_COLUMNS);

0 commit comments

Comments
 (0)