Skip to content

Conversation

ShaMan123
Copy link

@ShaMan123 ShaMan123 commented Oct 16, 2025

Proposed Changes

Related to #26, preliminary work
Closes #25

Indexing paths means the index needs to hold the path in memory, making caching redundant.
So I wish to unblock myself before moving forward.

I have encapsulated all caching logic into a single method getPathCurve.
This is a main entry point that will not be used by the indexing method.
This is where path parsing is handled as well.

I don't really understand why there are 3 levels of caching (curve, abs, arr) and I find the caching engine a bit weird (does it rm an entry after 100 invocations?) but that is off topic and will be made redundant once indexing is used.

Additionally I took the opportunity to inspect pathClone usages. They were called excessively so I have removed those. The place that mutates path data is pathToCurve.
Then I looked into the implementation and decided to simplify it as well (for perf, readability and code quality).

I exposed parsePathCurve so a consumer can opt out of internal path caching.

Finally, I've extracted isBBoxIntersect early return up to its caller since the spatial index will be handling bbox intersection logic.

Checklist

To ensure you provided everything we need to look at your PR:

  • Brief textual description of the changes present
  • Visual demo attached
  • Steps to try out present, i.e. using the @bpmn-io/sr tool
  • Related issue linked via Closes {LINK_TO_ISSUE} or Related to {LINK_TO_ISSUE}

@CLAassistant
Copy link

CLAassistant commented Oct 16, 2025

CLA assistant check
All committers have signed the CLA.

Copy link
Author

@ShaMan123 ShaMan123 left a comment

Choose a reason for hiding this comment

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

stable and ready for review

(pth.arr = (

// rough assumption
(!isArray(path) || !isArray(path && path[0]))) ?
Copy link
Author

Choose a reason for hiding this comment

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

I don't understand this...

Suggested change
(!isArray(path) || !isArray(path && path[0]))) ?
typeof path === 'string' ?

@barmac
Copy link
Member

barmac commented Oct 17, 2025

The current CI failure is not related to your PR. Let me fix that...

@barmac
Copy link
Member

barmac commented Oct 17, 2025

The current CI failure is not related to your PR. Let me fix that...

Problem will be fixed via #28
You can rebase your work on main after the PR is merged.

@ShaMan123
Copy link
Author

add prettierrc to make my life easier but still there is whitespace mayham

@ShaMan123 ShaMan123 mentioned this pull request Oct 17, 2025
4 tasks
@nikku
Copy link
Member

nikku commented Oct 17, 2025

add prettierrc to make my life easier but still there is whitespace mayham

Please do not do that. Keep changes minimal, easy to follow.

@ShaMan123
Copy link
Author

I believe I kept changes minimal as possible.
I can revert prettierrc but I added it because I didn't want to commit whitespace changes.
If prettier is installed in vscode it takes over...
Nvm

@ShaMan123
Copy link
Author

I expected lint to fix whitespace but it doesn't

@ShaMan123 ShaMan123 force-pushed the chore/cache-cleanup branch from d63f633 to a773a2e Compare October 19, 2025 05:27
Copy link
Author

@ShaMan123 ShaMan123 left a comment

Choose a reason for hiding this comment

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

expose parsePathCurve

@ShaMan123 ShaMan123 force-pushed the chore/cache-cleanup branch from c01af55 to 9cfa863 Compare October 19, 2025 08:33
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.

Increase performance by reducing path parsing

4 participants