cabaletta / cabaletta/baritone

Possible optimization for dynamic-connectivity

Open
#3,912 8 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Java
Stars
9.2k
Forks
2.1k
Avg merge
4d 3h
Merged PRs (30d)
3

Description

## Describe your suggestion
Apologies, I wasn't sure where to post this. According to https://github.com/btrekkie/dynamic-connectivity/issues/4#issue-1649440171 , @leijurv is considering incorporating a fork of https://github.com/btrekkie/dynamic-connectivity into Baritone. Based on a profiler screenshot in his comment, I thought of a potential optimization for this library.

I realized that `Augmentation.combine` is called **a lot**, and in typical usage, it creates a new object each time it is called. I came up with this to reduce the number of object allocations: https://github.com/btrekkie/dynamic-connectivity/compare/master...augmentation-pool . (Maybe start by looking at https://github.com/btrekkie/dynamic-connectivity/commit/1586a7c7a6d52ff7b189ad4db017d8be5c37aacf#diff-06e896ad5b668fbe72375bf3a901e696429004e18c61104559fdde04d26360a7 and https://github.com/btrekkie/dynamic-connectivity/commit/1586a7c7a6d52ff7b189ad4db017d8be5c37aacf#diff-1ff29087d4530c92b31fe61df3b855074ac0e88f4f54f6cd88bb441bc109e92fR163-R166 .) It would require switching from using `Augmentation` to using `MutatingAugmentation`. I wouldn't want to merge it into https://github.com/btrekkie/dynamic-connectivity without measuring its real-world performance, but I thought you might want to give it a try.

Also, you might try overriding `Attachment.equals`, as this could reduce the number of calls to `augment()`. (See https://github.com/btrekkie/dynamic-connectivity/blob/e7f54ab81da5cfd62908f870ccbfb68baec42b30/src/main/java/com/github/leijurv/NavigableSurface.java#L25 . )

## Settings
N/A

## Context
This could make things faster.

## Final checklist
- [x] I know how to properly use check boxes
- [x] I have not used any OwO's or UwU's in this issue.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.