mirror of
https://github.com/zeek/zeek.git
synced 2025-10-07 00:58:19 +00:00
Type: Add TypeManager->TypeList() and use for ListVal()
It turns out that for every ListVal we construct, we also allocate and construct a new TypeList instance, even though they are all the same. Pre-create and cache the type instances in a new TypeManager. The following script runs ~10% faster for me after this change. global tbl: table[string] of string; global i = 0; while ( ++i < 10000000 ) tbl["a"] = "a";
This commit is contained in:
parent
04a2ee7220
commit
24c606b4df
4 changed files with 36 additions and 4 deletions
|
@ -172,6 +172,7 @@ void do_ssl_deinit()
|
|||
} // namespace
|
||||
#endif
|
||||
|
||||
zeek::TypeManager* zeek::type_mgr = nullptr;
|
||||
zeek::ValManager* zeek::val_mgr = nullptr;
|
||||
zeek::packet_analysis::Manager* zeek::packet_mgr = nullptr;
|
||||
zeek::analyzer::Manager* zeek::analyzer_mgr = nullptr;
|
||||
|
@ -437,6 +438,7 @@ static void terminate_zeek()
|
|||
delete session_mgr;
|
||||
delete fragment_mgr;
|
||||
delete telemetry_mgr;
|
||||
delete type_mgr;
|
||||
|
||||
// free the global scope
|
||||
pop_scope();
|
||||
|
@ -593,6 +595,7 @@ SetupResult setup(int argc, char** argv, Options* zopts)
|
|||
|
||||
run_state::zeek_start_time = util::current_time(true);
|
||||
|
||||
type_mgr = new TypeManager();
|
||||
val_mgr = new ValManager();
|
||||
reporter = new Reporter(options.abort_on_scripting_errors);
|
||||
thread_mgr = new threading::Manager();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue