Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generating optimized chained subparts #138

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

lukem12345
Copy link
Member

Close #137

I did some exploring around the chained subparts issue. There are a few design decisions/ features that came up that are worth exploring:

  1. Type inference was previously broken as demonstrated in the linked issue. This branch (currently) fixes that issue by always @generate-ing the chained subparts function.
  2. The validation code was intertwined with the accessing code. I believe that this impedes getting a function that can be optimized to have no allocations.
  3. The validation code only returns the first mismatched dom and codom pair. It would be something of a mini-feature to return all mismatched pairs instead of just the first one found.
  4. It would be nice to have a version of the chained subparts function that does the validation checking and accessing, and one that does not have the validation overhead. This branch (currently) fixes that issue by always validating when given the (:src,) syntax, and never validating when given a Val((:src,)). It would be nice to split the difference by only checking this at compile time, and guaranteeing that only valid chained subparts functions are generated. I'm not sure if the original CompTime implementation was supposed to guarantee this or not.

With the way that this function is written, the Expr for a chained subparts function is returned. This has higher overhead of course that the expression that is just built up from a native foldl. I can add this feature in before this PR would be merged.

This PR unfortunately did away with the use of CompTime.jl. I believe that this library could assist with points 3 and 4, but I am not sure how to go about doing that at this moment.

@lukem12345 lukem12345 changed the title Always generate chained subparts, skip validation with Val Generating optimized chained subparts May 28, 2024
Copy link

codecov bot commented May 28, 2024

Codecov Report

Attention: Patch coverage is 93.75000% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 91.87%. Comparing base (a24aeea) to head (dbb66d1).

Files Patch % Lines
src/DenseACSets.jl 93.75% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #138      +/-   ##
==========================================
+ Coverage   91.81%   91.87%   +0.06%     
==========================================
  Files          23       23              
  Lines        2088     2092       +4     
==========================================
+ Hits         1917     1922       +5     
+ Misses        171      170       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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.

Performance improvements in chained subparts syntax
1 participant