ixmp icon indicating copy to clipboard operation
ixmp copied to clipboard

Add batch removal for remove par

Open Wegatriespython opened this issue 3 months ago • 10 comments

This PR uses a batch removal method for remove_par

Linked to PR 403 in ixmp_source, this PR adds a batch method to improve performance on remove_par.

For longer context, the current implementation of remove_par in ixmp/backend/jdbc.py via item_delete_elements() in the JDBC class, iterates through each K,V pair and calls the backend removeElement for each element. This results in a O(n^2) operation as the backend scans through the element list for each removal O(n), which when called n times results in an O(n^2) operation.

To remedy this performance bottleneck a new batch removal method was added to ixmp_source in the aforementioned PR 403, now in jdbc.py when the length of removals is >1 we call the batch removal method instead of the single item removal.

Attached in this PR is the compiled jar file.

How to review

To review this PR, read the code diff, check the PR on ixmp_source. Verify all tests pass and run through actual scenarios. Recommendation is to allow for this branch to be opt-in to collect real use-case data to see if there are any un-intended side-effects from the java recompilation before merging into main.

PR checklist

  • [ ] Continuous integration checks all ✅
  • [ ] Add or expand tests; coverage checks both ✅
  • [ ] Add, expand, or update documentation.
  • [ ] Update release notes.

Wegatriespython avatar Oct 17 '25 12:10 Wegatriespython