Open wrayre opened 4 months ago
Inspecting the code here, I don't see any obvious performance bottlenecks. We loop through all of the productions once per call to add_prods_of_type_to_fc_list
(5 times) and then call std::sort
, which is documented as being an N*log(N), so the complexity should be roughly 5N + N*log(N).
Unless I've missed something here, there must be a basic operation that we thought would be fast but isn't. Will have to debug to find out what exactly.
I have a largish Soar agent (120k productions). When I try to run fc, Soar essentially hangs (not a core dump, but the process pegs out the CPU and does not return after a long while -- have waited 30m). stats is fine. fc # is fine (fc 10 is immediate, fc 2000 sees a short wait and then prints fine). At first I thought this might be due to some issues with chunking (learning a lot of chunks and some individual chunks have very large fcs), but if I just load the agent, run 1 d, and then fc, it hangs. It seems like there is some interaction with the size of production memory and fc. For instance, if I load only 10k productions (~~10% of this agent), there is no obvious issue: fc returns more or less immediately and I see a firing count number for each production. Running on MacOS with 16GB of RAM in case it's relevant.