mirror of
https://github.com/Expand-sys/CCash
synced 2026-03-22 20:47:10 +11:00
🐎 reworked memory prefetching for lower memory usage
This commit is contained in:
parent
74861d8a74
commit
4d52d4c821
3 changed files with 8 additions and 9 deletions
|
|
@ -84,6 +84,7 @@ Go to `{ip}/BankF/help` to see the bank's methods (also found in releases as hel
|
|||
|
||||
- **RESTful** API for connected services like a market, gambling, or anything else you can think of
|
||||
- able to be used millions of blocks away, across dimensions, servers, **vanilla or modded**. In contrast to an in-game modded implementation that would be range limited.
|
||||
- **Logging** of all transactions, configurable in (log_consts.hpp)[include/log_consts.hpp]
|
||||
|
||||
## Dependencies
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
#include <array>
|
||||
#include <algorithm>
|
||||
#include "log_consts.hpp"
|
||||
#include "transactions.hpp"
|
||||
|
||||
struct Log
|
||||
|
|
@ -9,19 +10,16 @@ struct Log
|
|||
uint32_t end = 0;
|
||||
void AddTrans(Transaction &&v)
|
||||
{
|
||||
if (!data.size())
|
||||
if (data.size() == end)
|
||||
{
|
||||
data.resize(50);
|
||||
data.resize(data.size()+pre_log_size); //prefetching memory
|
||||
}
|
||||
if (end)
|
||||
for (uint32_t i = end; i > 0; --i)
|
||||
{
|
||||
for (uint32_t i = end; i > 0; --i)
|
||||
{
|
||||
data[i] = std::move(data[i - 1]);
|
||||
}
|
||||
data[i] = std::move(data[i - 1]);
|
||||
}
|
||||
data[0] = std::move(v);
|
||||
if (end < 50)
|
||||
if (end < max_log_size)
|
||||
{
|
||||
++end;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ struct User
|
|||
{
|
||||
if(log_j.size())
|
||||
{
|
||||
log.data.resize(50);
|
||||
log.data.resize(log_j.size()+pre_log_size);
|
||||
log.end = log_j.size();
|
||||
for(uint32_t i = 0; i < log_j.size(); ++i)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue