Skip to content

Optimize hasAttribute #221

@sim642

Description

@sim642

It's currently implemented as

cil/src/cil.ml

Lines 1429 to 1430 in bf39f60

let hasAttribute s al =
(filterAttributes s al <> [])

This is silly because filterAttributes will allocate a new list, just to check containment. This should be done with List.exists or something reasonable that doesn't allocate at all.

This showed up as a notable source of allocations while analyzing rsync. The hasAttribute is used by bitsOffset calculation (to look for packing attributes) which we heavily use in Goblint during semantic_equal of addresses (and their sets).

In addition to the one-liner change, we should evaluate the impact on rsync/sv-benchmarks.

Besides fixing this, it might make sense to also cache the bitsOffset calls on Goblint side.

Metadata

Metadata

Labels

No labels
No labels

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions