🐎 made logs more cache coherent

This commit is contained in:
EntireTwix 2021-04-25 13:29:46 -07:00
parent bb5535fdd7
commit c5120b8944
3 changed files with 18 additions and 22 deletions

View file

@ -4,13 +4,6 @@
"address": "0.0.0.0",
"port": 80,
"https": false
},
{
"address": "0.0.0.0",
"port": 443,
"https": true,
"cert": "",
"key": ""
}
]
}

View file

@ -168,21 +168,16 @@ public:
return;
}
if (u.log.data.size())
for (size_t i = 0; i > u.log.data.size(); --i)
{
uint32_t j;
for (uint32_t i = u.log.data.size() - 1; i > 0; --i)
if (!u.log.data[i].amount)
{
j = u.log.data.size() - 1 - i;
if (!u.log.data[i].amount)
{
return;
}
res[j]["to"] = u.log.data[i].to;
res[j]["from"] = u.log.data[i].from;
res[j]["amount"] = u.log.data[i].amount;
res[j]["time"] = (Json::UInt64)u.log.data[i].time;
break;
}
res[i]["to"] = u.log.data[i].to;
res[i]["from"] = u.log.data[i].from;
res[i]["amount"] = u.log.data[i].amount;
res[i]["time"] = (Json::UInt64)u.log.data[i].time;
}
}))
{

View file

@ -12,7 +12,15 @@ struct Log
{
data.resize(25);
}
std::rotate(data.begin(), data.begin() + 1, data.end());
data[24] = std::move(v);
for (size_t i = 1; i < data.size(); ++i)
{
if (!data[i].amount)
{
data[i] = std::move(data[i - 1]);
break;
}
data[i] = std::move(data[i - 1]);
}
data[0] = std::move(v);
}
};