Hello,
i am using CaDiCal as a backend for the Bitwuzla SMT solver.
Currently i am benchmarking my program and trying to optimize it for runtime.
When generating a flame graph i realized that the majority of the time that bitwuzla is running is spend in the initialization step of CaDiCal.
I am by no means an expert in memory management or very low level C, but judging from the functions that the time is spend in and looking at the code it feels like there is a lot of resizing happening whenever a new variable is initialized leading to a lot of costly memory operations.
This might be some kind of niche problem, since we are checking very many, but relatively easy to solve queries.
However it feels wrong that the initialization takes more time than the actual solving.
When i think about this problem, i would iterate over the whole Term an then allocate the vector size that i need only once.
Am i missing something?
Just by briefly looking at the code i was not able to understand everything, but maybe you can tell whether this is a hard problem to solve or if you have thought about this before.
I attached two screenshots from the flamegraph showing the time spend in each function.
Thanks,
Simon


Hello,
i am using CaDiCal as a backend for the Bitwuzla SMT solver.
Currently i am benchmarking my program and trying to optimize it for runtime.
When generating a flame graph i realized that the majority of the time that bitwuzla is running is spend in the initialization step of CaDiCal.
I am by no means an expert in memory management or very low level C, but judging from the functions that the time is spend in and looking at the code it feels like there is a lot of resizing happening whenever a new variable is initialized leading to a lot of costly memory operations.
This might be some kind of niche problem, since we are checking very many, but relatively easy to solve queries.
However it feels wrong that the initialization takes more time than the actual solving.
When i think about this problem, i would iterate over the whole Term an then allocate the vector size that i need only once.
Am i missing something?
Just by briefly looking at the code i was not able to understand everything, but maybe you can tell whether this is a hard problem to solve or if you have thought about this before.
I attached two screenshots from the flamegraph showing the time spend in each function.
Thanks,
Simon