Skip to content

[REFACTOR] std::set usage to LLVM 17’s SmallPtrSet #16

@Casperento

Description

@Casperento

The project currently uses std::set in various places to store unique elements. However, std::set is typically implemented as a balanced tree, which can be inefficient, especially for small sets of pointers.

LLVM 17 provides llvm::SmallPtrSet, which is optimized for such cases, offering better cache locality and performance. This refactoring aims to replace instances of std::set<T*> with llvm::SmallPtrSet<T*, N>, where N is chosen based on expected usage patterns.

While we recommend using SmallPtrSet, you are free to select a different LLVM data structure if it better suits a specific use case.

Tasks

  1. Identify all occurrences of std::set<T*> and evaluate whether they can be replaced with llvm::SmallPtrSet<T*, N>.
  2. Replace applicable instances, selecting an appropriate inline size (N) to optimize performance.
  3. Ensure all affected code compiles and passes existing tests.

References

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions