You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
let ts =if get_interval_threshold_widening_constants ()="comparisons"thenWideningThresholds.upper_thresholds ()elseResettableLazy.force widening_thresholds in
let u =Ints_t.to_bigint u in
let max_ik' =Ints_t.to_bigint max_ik in
let t =List.find_opt (funx -> Z.compare u x <=0&&Z.compare x max_ik' <=0) ts in
BatOption.map_default Ints_t.of_bigint max_ik t
This linear search is $$O(n)$$ while the same lookup in binary search trees would be $$O(\log n)$$. And actually Set.Make.find_first_opt from the OCaml standard library can be used exactly for this purpose (because that's what Sets are internally).
So we could avoid the intermediate lists and do the more efficient search on sets directly. Although I doubt it will make a notable difference to Goblint performance as a whole.
The text was updated successfully, but these errors were encountered:
When widening thresholds are collected from the program, we do use a
Set
to avoid duplicates, but then it's just converted to a list withelements
:analyzer/src/cdomain/value/util/wideningThresholds.ml
Lines 103 to 108 in bb6f9aa
Later,
IntDomain
uses this list by linearly searching for the next thresholdx
foru
:analyzer/src/cdomain/value/cdomains/intDomain.ml
Lines 563 to 568 in bb6f9aa
This linear search is$$O(n)$$ while the same lookup in binary search trees would be $$O(\log n)$$ . And actually
Set.Make.find_first_opt
from the OCaml standard library can be used exactly for this purpose (because that's whatSet
s are internally).So we could avoid the intermediate lists and do the more efficient search on sets directly. Although I doubt it will make a notable difference to Goblint performance as a whole.
The text was updated successfully, but these errors were encountered: