mirror of
https://github.com/open-goal/jak-project
synced 2026-07-08 22:45:00 -04:00
[goalc] Cleaned up speedups (#3066)
Started at 349,880,038 allocations and 42s - Switched to making `Symbol` in GOOS be a "fixed type", just a wrapper around a `const char*` pointing to the string in the symbol table. This is a step toward making a lot of things better, but by itself not a huge improvement. Some things may be worse due to more temp `std::string` allocations, but one day all these can be removed. On linux it saved allocations (347,685,429), and saved a second or two (41 s). - cache `#t` and `#f` in interpreter, better lookup for special forms/builtins (hashtable of pointers instead of strings, vector for the small special form list). Dropped time to 38s. - special-case in quasiquote when splicing is the last thing in a list. Allocation dropped to 340,603,082 - custom hash table for environment lookups (lexical vars). Dropped to 36s and 314,637,194 - less allocation in `read_list` 311,613,616. Time about the same. - `let` and `let*` in Interpreter.cpp 191,988,083, time down to 28s.
This commit is contained in:
@@ -136,7 +136,7 @@ goos::Object MakeSystem::handle_defstep(const goos::Object& form,
|
||||
step->outputs.push_back(m_path_map.apply_remaps(obj.as_string()->data));
|
||||
});
|
||||
|
||||
step->tool = args.get_named("tool").as_symbol()->name;
|
||||
step->tool = args.get_named("tool").as_symbol().name_ptr;
|
||||
|
||||
if (m_tools.find(step->tool) == m_tools.end()) {
|
||||
throw std::runtime_error(fmt::format("The tool {} is unknown.", step->tool));
|
||||
@@ -232,7 +232,7 @@ goos::Object MakeSystem::handle_get_gsrc_path(const goos::Object& form,
|
||||
if (m_gsrc_files.count(file_name) != 0) {
|
||||
return goos::StringObject::make_new(m_gsrc_files.at(file_name));
|
||||
} else {
|
||||
return goos::SymbolObject::make_new(m_goos.reader.symbolTable, "#f");
|
||||
return goos::Object::make_symbol(&m_goos.reader.symbolTable, "#f");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user