openrewrite / openrewrite/rewrite

[memory optimization] avoid duplicate strings for standard method parameter names

Open
#3,140 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Java
Stars
3.7k
Forks
570
Avg merge
13h 12m
Merged PRs (30d)
261

Description

While running profiling sessions on the Spring Tools, I came across many duplicated String objects arg0, all referenced via org.openrewrite.java.tree.JavaType$Method.

This was actually top 1 of duplicated strings in my profiling session (> 10.000 times), followed by arg1. arg2 and arg3 also showed up in that list.

Even though this looks like a minor optimization, I think it would make sense to introduce a static String object (or even a static ArrayList) for those cases and reference that single object instead of keeping all those duplicated strings around.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at org.openrewrite.java.tree.JavaType$Method and inspect how standard parameter names such as arg0 through arg3 are created during profiling. Done means those standard names are shared rather than duplicated, with profiling or relevant tests confirming the memory improvement.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
devtools, performance
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.