mirror of
https://github.com/usatiuk/psil.git
synced 2025-10-28 10:47:49 +01:00
configurable gc threshold
This commit is contained in:
@@ -40,6 +40,7 @@ private:
|
|||||||
const static inline std::unordered_map<std::string, std::variant<size_t, bool>> _defaults{{"cell_limit", 50000U},
|
const static inline std::unordered_map<std::string, std::variant<size_t, bool>> _defaults{{"cell_limit", 50000U},
|
||||||
{"command_strs", false},
|
{"command_strs", false},
|
||||||
{"default_log_level", 1U},
|
{"default_log_level", 1U},
|
||||||
|
{"gc_threshold", 50U},
|
||||||
{"repl", true}};
|
{"repl", true}};
|
||||||
|
|
||||||
std::unordered_map<std::string, std::variant<size_t, bool>> _current = _defaults;
|
std::unordered_map<std::string, std::variant<size_t, bool>> _current = _defaults;
|
||||||
|
|||||||
@@ -95,7 +95,8 @@ private:
|
|||||||
std::lock_guard tmplg(_new_roots_lock);
|
std::lock_guard tmplg(_new_roots_lock);
|
||||||
Handle ret(cell);
|
Handle ret(cell);
|
||||||
_temp_cells.emplace_back(cell);
|
_temp_cells.emplace_back(cell);
|
||||||
if ((_cells_num + _temp_cells.size() + 1) >= (size_t) (Options::get<size_t>("cell_limit") / 2)) {
|
if ((_cells_num + _temp_cells.size()) >=
|
||||||
|
((Options::get<size_t>("cell_limit") * Options::get<size_t>("gc_threshold")) / 100ULL)) {
|
||||||
request_gc();
|
request_gc();
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ void VM::step() {
|
|||||||
if (!_d.null()) out << "d:" << _d << "\n";
|
if (!_d.null()) out << "d:" << _d << "\n";
|
||||||
},
|
},
|
||||||
Logger::TRACE);
|
Logger::TRACE);
|
||||||
|
|
||||||
switch (poppedCmd) {
|
switch (poppedCmd) {
|
||||||
case NIL: {
|
case NIL: {
|
||||||
_s.push(nullptr);
|
_s.push(nullptr);
|
||||||
@@ -300,6 +300,7 @@ void VM::step() {
|
|||||||
std::string read;
|
std::string read;
|
||||||
std::getline(_instream, read);
|
std::getline(_instream, read);
|
||||||
_s.push(Parser::parse_str(read));
|
_s.push(Parser::parse_str(read));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
throw std::invalid_argument("Unknown command: " + std::to_string(poppedCmd));
|
throw std::invalid_argument("Unknown command: " + std::to_string(poppedCmd));
|
||||||
|
|||||||
Reference in New Issue
Block a user