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

Improve the paths subsets of jobs #220

Merged
merged 6 commits into from
Oct 16, 2024
Merged

Improve the paths subsets of jobs #220

merged 6 commits into from
Oct 16, 2024

Conversation

sophiedeziel
Copy link
Collaborator

@sophiedeziel sophiedeziel commented Oct 12, 2024

Follow up to #211

layers, extrusions and travels are now more performant!

Instead of filtering the whole paths array each time, the job uses indexers to categorize paths as they are added. They are then accessed as readily available data without additional logic.

To implement indexes, logic to have paths "in progress" and finish them had to be implemented to only index when the path is finished.

Paths are indexed as they are added to a job, which is less expensive than filtering the array on the spot. Jobs have a set of default indexers. They can be added or removed for the different rendering modes. It paves the way to #121 as we'll have to index for the different types of extrusions. It is also a possible implementation for #183.

When an indexer throws an error, it is interpreted as not applicable for a specific job. It is removed from the list of indexers for the rest of the commands. I am pretty happy about that design; it stops some code and conditions from running for the rest of the list of paths we are iterating on.

Adding/removing indexers will have a significant impact later when we have many of them. Other logic related to stats and calculations may follow a similar design and benefit from being composed. If they become expensive, we'll only use what is needed.

Next PR would be to bring back the tolerance logic inside the indexer that was omitted in #211

Note that this branch was not rebased after #215, making progressive rendering a bit funky. With the fix, you'll notice the smoothness is back.

@sophiedeziel sophiedeziel marked this pull request as draft October 12, 2024 07:06
@sophiedeziel sophiedeziel marked this pull request as ready for review October 12, 2024 18:55
Base automatically changed from interpreter to v3.x October 13, 2024 15:20
@sophiedeziel sophiedeziel reopened this Oct 13, 2024
Copy link

github-actions bot commented Oct 13, 2024

Visit the preview URL for this PR (updated for commit 8c2c327):

https://gcode-preview--pr220-introduce-indexers-34ft8rl4.web.app

(expires Fri, 15 Nov 2024 00:54:46 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 59bd114ae4847b32c2bba0b68620b9069a3e3531

@sophiedeziel sophiedeziel force-pushed the introduce-indexers branch 2 times, most recently from 638adb2 to 76a4c17 Compare October 13, 2024 16:35
@sophiedeziel sophiedeziel changed the base branch from v3.x to develop October 13, 2024 18:03
@sophiedeziel
Copy link
Collaborator Author

sophiedeziel commented Oct 13, 2024

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @sophiedeziel and the rest of your teammates on Graphite Graphite

@sophiedeziel sophiedeziel force-pushed the introduce-indexers branch 2 times, most recently from 3071658 to cdaebe1 Compare October 14, 2024 00:06
@sophiedeziel sophiedeziel changed the base branch from develop to v3.x October 14, 2024 00:18
@sophiedeziel sophiedeziel force-pushed the introduce-indexers branch 3 times, most recently from 678a96f to 256595a Compare October 14, 2024 00:52
@sophiedeziel sophiedeziel force-pushed the introduce-indexers branch 2 times, most recently from e32e879 to d81f5ea Compare October 14, 2024 01:34
@sophiedeziel sophiedeziel mentioned this pull request Oct 14, 2024
@sophiedeziel sophiedeziel merged commit 8a52230 into v3.x Oct 16, 2024
3 checks passed
@sophiedeziel sophiedeziel deleted the introduce-indexers branch October 16, 2024 03:22
sophiedeziel added a commit that referenced this pull request Oct 19, 2024
* Introduce the traveltype indexer

* Add the layer indexer

* don't clear for all types

* Fix the calls to the getters

* Cleaner error management

* Fix all tests
sophiedeziel added a commit that referenced this pull request Oct 24, 2024
* Introduce the traveltype indexer

* Add the layer indexer

* don't clear for all types

* Fix the calls to the getters

* Cleaner error management

* Fix all tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant