Optimizations to relocation checks. Up to 3x faster#535
Optimizations to relocation checks. Up to 3x faster#535johnrengelman merged 1 commit intoGradleUp:masterfrom
Conversation
| interface Relocator { | ||
| String ROLE = Relocator.class.getName() | ||
|
|
||
| boolean canRelocatePath(RelocatePathContext context) |
There was a problem hiding this comment.
this is a breaking change. Is it really necessary? These context objects were introduced a while ago in order to abstract the details away as I was finding that we needed to add additional data for certain features.
There was a problem hiding this comment.
Oh, I see, you're just removing it from some of the methods.
There was a problem hiding this comment.
Yes, I removed context only from the methods that aren't using it. It's done to decrease the number of allocations we make and to save a bit of time on creating the builder
|
@Armaxis there are some conflicts now on this branch. Would you mind resolving them and then I’ll get this in as part of the 6.0 release. |
|
Sure, will do later today |
1 similar comment
|
Sure, will do later today |
c8b4631 to
dd19e9f
Compare
…mance boost on large project (5:48 -> 2:02 min total duration). - Changed signature of methods to accept String as path instead of RelocatePathContext/RelocateClassContext to prevent unnecessary allocations for builder objects - Added extra string length checks to avoid string operations where possible - Reordered checks in canRelocateClass so that expensive string replacement is the last operation - (Main Optimization) Avoided string concatenation (which led to creating StringBuilder instances and expensive array copy operations) by adding check for first character being '/': if so - perform a startsWith check with an offset. - Removed an incorrect length check - Moved context creation outside the loop
dd19e9f to
bce1218
Compare
Performance boost on large project (5:48 -> 2:02 min total duration).
Stringas path instead ofRelocatePathContext/RelocateClassContextto prevent unnecessary allocations for builder objectscanRelocateClassso that expensive string replacement is the last operationStringBuilderinstances and expensive array copy operations) by adding check for first character being/: if so - perform astartsWithcheck with an offset.