mirror of
https://github.com/open-goal/jak-project
synced 2026-09-09 20:21:28 -04:00
goalc: Fix new symbol trie's performance inefficiencies (#3443)
I believe this brings things back in line to where it was before: Here are the first handful of files before the changes: ``` 0.014 | gcommon.gc 0.006 | gkernel-h.gc 0.025 | gkernel.gc 0.002 | pskernel.gc 0.01 | gstring.gc 0.004 | gstate.gc 0.001 | kernel.gd 0.001 | types-h.gc 0.002 | vu1-macros.gc 0.003 | math.gc 0.01 | vector-h.gc 0.001 | gravity-h.gc 0.001 | bounding-box-h.gc 0.001 | matrix-h.gc 0.001 | quaternion-h.gc 0.001 | euler-h.gc ``` > first compile ``` 0.161 | gcommon.gc 0.126 | gkernel-h.gc 0.174 | gkernel.gc 0.046 | pskernel.gc 0.08 | gstring.gc 0.048 | gstate.gc 0.001 | kernel.gd 0.052 | types-h.gc 0.009 | vu1-macros.gc 0.059 | math.gc 0.228 | vector-h.gc 0.026 | gravity-h.gc 0.006 | bounding-box-h.gc 0.002 | matrix-h.gc 0.028 | quaternion-h.gc 0.026 | euler-h.gc ``` > make a change in gcommon and recompile With the changes: ``` 0.015 | gcommon.gc 0.018 | gkernel-h.gc 0.039 | gkernel.gc 0.006 | pskernel.gc 0.015 | gstring.gc 0.009 | gstate.gc 0.005 | kernel.gd 0.006 | types-h.gc 0.006 | vu1-macros.gc 0.008 | math.gc 0.017 | vector-h.gc 0.004 | gravity-h.gc 0.004 | bounding-box-h.gc 0.005 | matrix-h.gc 0.005 | quaternion-h.gc 0.003 | euler-h.gc ``` > First compile, no difference expected ``` 0.016 | gcommon.gc 0.008 | gkernel-h.gc 0.023 | gkernel.gc 0.002 | pskernel.gc 0.01 | gstring.gc 0.043 | gstate.gc 0.001 | kernel.gd 0.002 | types-h.gc 0.002 | vu1-macros.gc 0.003 | math.gc 0.013 | vector-h.gc 0.001 | gravity-h.gc 0.002 | bounding-box-h.gc 0.002 | matrix-h.gc 0.001 | quaternion-h.gc 0.001 | euler-h.gc ``` > Compile times seem to be back within margin of error -- some are faster than the first compilation time.
This commit is contained in:
@@ -358,8 +358,7 @@ Val* Compiler::compile_reload(const goos::Object& form, const goos::Object& rest
|
||||
return get_none();
|
||||
}
|
||||
|
||||
std::string Compiler::make_symbol_info_description(
|
||||
const std::shared_ptr<symbol_info::SymbolInfo> info) {
|
||||
std::string Compiler::make_symbol_info_description(const symbol_info::SymbolInfo* info) {
|
||||
switch (info->m_kind) {
|
||||
case symbol_info::Kind::GLOBAL_VAR:
|
||||
return fmt::format("[Global Variable] Type: {} Defined: {}",
|
||||
@@ -588,12 +587,12 @@ Val* Compiler::compile_update_macro_metadata(const goos::Object& form,
|
||||
return get_none();
|
||||
}
|
||||
|
||||
std::vector<std::shared_ptr<symbol_info::SymbolInfo>> Compiler::lookup_symbol_info_by_file(
|
||||
std::vector<symbol_info::SymbolInfo*> Compiler::lookup_symbol_info_by_file(
|
||||
const std::string& file_path) const {
|
||||
return m_symbol_info.lookup_symbols_by_file(file_path);
|
||||
}
|
||||
|
||||
std::vector<std::shared_ptr<symbol_info::SymbolInfo>> Compiler::lookup_symbol_info_by_prefix(
|
||||
std::vector<symbol_info::SymbolInfo*> Compiler::lookup_symbol_info_by_prefix(
|
||||
const std::string& prefix) const {
|
||||
return m_symbol_info.lookup_symbols_starting_with(prefix);
|
||||
}
|
||||
@@ -605,7 +604,7 @@ std::set<std::string> Compiler::lookup_symbol_names_starting_with(const std::str
|
||||
return {};
|
||||
}
|
||||
|
||||
std::vector<std::shared_ptr<symbol_info::SymbolInfo>> Compiler::lookup_exact_name_info(
|
||||
std::vector<symbol_info::SymbolInfo*> Compiler::lookup_exact_name_info(
|
||||
const std::string& name) const {
|
||||
if (m_goos.reader.check_string_is_valid(name)) {
|
||||
return m_symbol_info.lookup_exact_name(name);
|
||||
|
||||
Reference in New Issue
Block a user