Skip to content

Conversation

@vogella
Copy link
Contributor

@vogella vogella commented Oct 25, 2025

Optimizations:

  • Line 97: Added precompiled PATTERN_PATH_COLON regex pattern to avoid repeated compilation in stripPathInformation() method
  • Line 170: Changed from replaceAll() with string regex (which recompiles pattern each time) to using the precompiled pattern - significant performance
    improvement in hot paths
  • Line 327: Modernized array creation using method reference String[]::new instead of new String[result.size()]
  • Line 423-450: Refactored getTargetVersionString() method to use modern switch expression, reducing from 26 lines with repetitive if-statements to 14 lines -
    much cleaner and more maintainable
  • Line 623-627: Simplified getFeaturePaths() to use streams instead of manual list iteration - more functional and readable
  • Line 703-709: Improved thread-safety of addTargetDefinitionMap() by making it synchronized and using computeIfAbsent() to eliminate race conditions and
    simplify logic

Impact:

  • Reduced regex compilation overhead in path processing
  • Better thread safety for cached data
  • Improved code readability with modern Java patterns
  • No API changes - all improvements are internal

@vogella
Copy link
Contributor Author

vogella commented Oct 25, 2025

I assume the build will fail (PDE build is currently not working), so I plan to leave this here and return to it, once PDE build are green again.


private static Map<String, String> fgCachedLocations;
private static Map<ITargetHandle, List<TargetDefinition>> fgCachedTargetDefinitionMap = new HashMap<>();
// Use concurrent map to avoid synchronization overhead on read operations
Copy link
Member

Choose a reason for hiding this comment

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

comment doesn't match code

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

}
}
return list.toArray(new String[list.size()]);
return Arrays.stream(models)
Copy link
Member

Choose a reason for hiding this comment

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

This is highly questionable, as it makes no improvement functionally, and makes debugging impossible.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed back

@github-actions
Copy link

github-actions bot commented Oct 25, 2025

Test Results

   745 files   -  26     745 suites   - 26   47m 32s ⏱️ - 12m 17s
 3 633 tests ±  0   3 578 ✅ ±  0   54 💤 ± 0  1 ❌ ±0 
10 445 runs   - 388  10 293 ✅  - 376  150 💤  - 13  2 ❌ +1 

For more details on these failures, see this check.

Results for commit e4cac57. ± Comparison against base commit f2cc40b.

♻️ This comment has been updated with latest results.

Optimized regex pattern compilation by precompiling PATTERN_PATH_COLON
pattern used in stripPathInformation() method. Simplified switch
expression in getTargetVersionString() and improved thread-safety in
addTargetDefinitionMap() using computeIfAbsent().

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@vogella vogella force-pushed the target-platform-helper branch from f57d3be to e4cac57 Compare November 2, 2025 11:53
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.

2 participants