Skip to content

Commit

Permalink
Merge pull request #732 from evoskuil/master
Browse files Browse the repository at this point in the history
Store changed point table to simple array.
  • Loading branch information
evoskuil authored Feb 9, 2025
2 parents f3a2f18 + 8951cc7 commit 7e3878d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 85 deletions.
2 changes: 0 additions & 2 deletions console/executor_dumps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ void executor::dump_buckets() const
query_.header_buckets() %
query_.txs_buckets() %
query_.tx_buckets() %
query_.point_buckets() %
query_.spend_buckets() %
query_.prevout_buckets() %
query_.strong_tx_buckets() %
Expand All @@ -144,7 +143,6 @@ void executor::dump_collisions() const
(to_double(query_.header_records()) / query_.header_buckets()) %
(to_double(query_.header_records()) / query_.txs_buckets()) %
(to_double(query_.tx_records()) / query_.tx_buckets()) %
(to_double(query_.point_records()) / query_.point_buckets()) %
(to_double(query_.spend_records()) / query_.spend_buckets()) %
(to_double(query_.prevout_records()) / query_.prevout_buckets()) %
(to_double(query_.strong_tx_records()) / query_.strong_tx_buckets()) %
Expand Down
61 changes: 1 addition & 60 deletions console/executor_scans.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,29 +190,6 @@ void executor::scan_buckets() const

// ------------------------------------------------------------------------

filled = zero;
bucket = max_size_t;
start = logger::now();
while (!cancel_ && (++bucket < query_.point_buckets()))
{
const auto top = query_.top_point(bucket);
if (!top.is_terminal())
++filled;

if (is_zero(bucket % tx_frequency))
logger(format("point" BN_READ_ROW) % bucket %
duration_cast<seconds>(logger::now() - start).count());
}

if (cancel_)
logger(BN_OPERATION_CANCELED);

span = duration_cast<seconds>(logger::now() - start);
logger(format("point" BN_READ_ROW) % (to_double(filled) / bucket) %
span.count());

// ------------------------------------------------------------------------

filled = zero;
bucket = max_size_t;
start = logger::now();
Expand Down Expand Up @@ -381,42 +358,6 @@ void executor::scan_collisions() const
strong_tx.clear();
strong_tx.shrink_to_fit();

// point
// ------------------------------------------------------------------------

index = max_size_t;
start = logger::now();
const auto point_buckets = query_.point_buckets();
const auto point_records = query_.point_records();
std_vector<size_t> point(point_buckets, empty);
while (!cancel_ && (++index < point_records))
{
const tx_link link{ possible_narrow_cast<tx_link::integer>(index) };
++point.at(hash(query_.get_point_key(link.value)) % point_buckets);

if (is_zero(index % tx_frequency))
logger(format("point" BN_READ_ROW) % index %
duration_cast<seconds>(logger::now() - start).count());
}

if (cancel_)
logger(BN_OPERATION_CANCELED);

// ........................................................................

const auto point_count = count(point);
span = duration_cast<seconds>(logger::now() - start);
logger(format("point: %1% in %2%s buckets %3% filled %4% rate %5%") %
index % span.count() % point_buckets % point_count %
(to_double(point_count) / point_buckets));

for (const auto& entry: dump(point))
logger(format("point: %1% frequency: %2%") %
entry.first % entry.second);

point.clear();
point.shrink_to_fit();

// spend
// ------------------------------------------------------------------------

Expand All @@ -435,7 +376,7 @@ void executor::scan_collisions() const
for (const auto& in: inputs)
{
++total;
++spend.at(hash(query_.to_spend_key(in)) % spend_buckets);
++spend.at(hash(query_.get_spend_key(in)) % spend_buckets);

if (is_zero(index % put_frequency))
logger(format("spend" BN_READ_ROW) % total %
Expand Down
30 changes: 14 additions & 16 deletions console/localize.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,27 +110,25 @@ namespace node {
" header :%1%\n" \
" txs :%2%\n" \
" tx :%3%\n" \
" point :%4%\n" \
" spend :%5%\n" \
" prevout :%6%\n" \
" strong_tx :%7%\n" \
" valid_tx :%8%\n" \
" valid_bk :%9%\n" \
" address :%10%\n" \
" neutrino :%11%"
" spend :%4%\n" \
" prevout :%5%\n" \
" strong_tx :%6%\n" \
" valid_tx :%7%\n" \
" valid_bk :%8%\n" \
" address :%9%\n" \
" neutrino :%10%"
#define BN_MEASURE_COLLISION_RATES \
"Collision rates...\n" \
" header :%1%\n" \
" txs :%2%\n" \
" tx :%3%\n" \
" point :%4%\n" \
" spend :%5%\n" \
" prevout :%6%\n" \
" strong_tx :%7%\n" \
" valid_tx :%8%\n" \
" valid_bk :%9%\n" \
" address :%10%\n" \
" neutrino :%11%"
" spend :%4%\n" \
" prevout :%5%\n" \
" strong_tx :%6%\n" \
" valid_tx :%7%\n" \
" valid_bk :%8%\n" \
" address :%9%\n" \
" neutrino :%10%"
#define BN_MEASURE_PROGRESS_START \
"Thinking..."
#define BN_MEASURE_PROGRESS \
Expand Down
7 changes: 0 additions & 7 deletions src/parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,6 @@ parser::parser(system::chain::selection context) NOEXCEPT
configured.database.output_size = 25'300'000'000;
configured.database.output_rate = 5;

// Full size too big for mini, so reduced to compressed size.
configured.database.point_buckets = 546'188'501;
configured.database.point_size = 8'389'074'978;
configured.database.point_rate = 5;

Expand Down Expand Up @@ -695,11 +693,6 @@ options_metadata parser::load_settings() THROWS
)

/* point */
(
"database.point_buckets",
value<uint32_t>(&configured.database.point_buckets),
"The number of buckets in the point table head, defaults to '546188501'."
)
(
"database.point_size",
value<uint64_t>(&configured.database.point_size),
Expand Down

0 comments on commit 7e3878d

Please sign in to comment.