Skip to content

Conversation

@christian-schilling
Copy link
Member

It was discovered during profiling that filter optimisation spends lots of time rearranging chains.
Using a vec will make operations like finding the last element in a chain much faster.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the Chain filter operation from a binary tree structure Chain(Filter, Filter) to a vector-based structure Chain(Vec<Filter>). The motivation is to improve performance during filter optimization, specifically making operations like finding the last element in a chain much faster.

Key Changes:

  • Changed Op::Chain from storing two Filter arguments to storing a Vec<Filter>
  • Updated all filter optimization algorithms (simplify, flatten, step, invert) to work with vector-based chains
  • Modified parsing to accumulate chain elements into a vector
  • Updated serialization/deserialization to handle variable-length chains
  • Adjusted all filter application logic to iterate through chain vectors

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
josh-core/src/filter/op.rs Changed Chain enum variant from two Filter parameters to Vec
josh-core/src/flang/parse.rs Updated parsing to build chains as vectors, handling accumulation of multiple filters
josh-core/src/filter/persist.rs Modified serialization to store variable-length chains; deserialization now reads arbitrary number of chain elements
josh-core/src/filter/opt.rs Completely rewrote chain optimization logic to handle vectors: flattening nested chains, combining adjacent operations, and handling empty/single-element cases
josh-core/src/filter/mod.rs Updated all chain-related operations (apply, unapply, lazy_refs, resolve_refs, path calculations) to iterate through vectors
josh-core/src/flang/mod.rs Modified pretty-printing and spec generation to handle vector-based chains with special cases for empty and two-element chains
josh-core/src/build.rs Updated chain builder function to wrap arguments in a vector
tests//.t Test expectations updated to reflect new chain representation with flat numbering (chain/0, chain/1, chain/2) instead of nested (chain/0/chain/0/chain/0)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

It was discovered during profiling that filter optimisation
spends lots of time rearranging chains.
Using a vec will make operations like finding the last element
in a chain much faster.
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.

2 participants