Skip to content

Conversation

@jorik-utwente
Copy link

Two small changes that fix the project to work with the most recent version of angr.

Chapoly1305 added a commit to Chapoly1305/libmatch that referenced this pull request Jan 11, 2026
Implement optimizations identified in optimization_review.md:

- Issue subwire#1: Precompute block attributes in LMD during initialization
  Caches graph traversal results (O(V+E)) for O(1) lookup per FunctionDiff.
  Falls back gracefully for LMDs created before this optimization.

- Issue #9: Compute bidirectional distance matrix once
  _get_bidirectional_closest_matches computes the distance matrix once
  and extracts closest matches for both directions (A→B and B→A).

- Issue subwire#3: Build symbol address hash table in LMD
  Converts O(n) symbol_for_addr lookup to O(1) hash table lookup.

- Issue #5: Change recursion_list to recursion_set
  Uses set for O(1) membership test and removal instead of O(n) list ops.

- Issue subwire#2: Add block_similarity() caching
  Caches similarity results to avoid recomputation for same block pairs.

- Issue #8: Fix _is_better_match() duplicate distance computation
  Computes distance once and reuses for both comparisons.

Expected improvement: 35-50% reduction in Phase 2 processing time
when using LMDs with precomputed block attributes.
Chapoly1305 added a commit to Chapoly1305/libmatch that referenced this pull request Jan 11, 2026
Implement optimizations identified in optimization_review.md:

- Issue subwire#1: Precompute block attributes in LMD during initialization
  Caches graph traversal results (O(V+E)) for O(1) lookup per FunctionDiff.
  Falls back gracefully for LMDs created before this optimization.

- Issue #9: Compute bidirectional distance matrix once
  _get_bidirectional_closest_matches computes the distance matrix once
  and extracts closest matches for both directions (A→B and B→A).

- Issue subwire#3: Build symbol address hash table in LMD
  Converts O(n) symbol_for_addr lookup to O(1) hash table lookup.

- Issue #5: Change recursion_list to recursion_set
  Uses set for O(1) membership test and removal instead of O(n) list ops.

- Issue subwire#2: Add block_similarity() caching
  Caches similarity results to avoid recomputation for same block pairs.

- Issue #8: Fix _is_better_match() duplicate distance computation
  Computes distance once and reuses for both comparisons.

Expected improvement: 35-50% reduction in Phase 2 processing time
when using LMDs with precomputed block attributes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant