JMeterTreeNode addComponent overloads GUI operations
- Dominant language
- Java
- Stars
- 9.5k
- Forks
- 2.3k
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 5
Description
### Expected behavior
When adding multiple elements in a short period of time, only recreate the UI of the focused component at the end of all operations.
This is for check and analyze, it is a suggestion for improvement.
### Actual behavior
Inside this block of operation
https://github.com/apache/jmeter/blob/master/src/core/src/main/java/org/apache/jmeter/gui/tree/JMeterTreeModel.java#L158
What happens is that on each addComponent operation, the UI of the component and the focused component in the UI are sent to update.
When adding many components in a very short time, such as proxy recording, you may notice that the focused screen is being recreated for each recorded sample.
https://github.com/apache/jmeter/blob/d8a6876169ea6327b8c20f23445a472af32f4276/src/protocol/http/src/main/java/org/apache/jmeter/protocol/http/proxy/ProxyControl.java#L1217
Part of the problem is that getCurrentGui is called which reconfigures and redraws again.
https://github.com/apache/jmeter/blob/master/src/core/src/main/java/org/apache/jmeter/gui/tree/JMeterTreeModel.java#L164
Perhaps it is possible to change the way or the moment in which it is sent to carry out these operations, so that it is after the addComponent is carried out so that the operation is at the end.
I think the usage of that code block inside that "if" and the getCurrentGui it's like a trick or hack, maybe not is the best place to add this operations.
### Steps to reproduce the problem
If you use, for example, the http recorder and you managed to queue a large number of requests in a short time, in less than 200ms.
If you have a screen in focus that takes time to redraw, you may notice the focused component redraw and refresh as all requests are processed.
There are probably other ways to reproduce it.
### JMeter Version
5.x
### Java Version
+1.8
### OS Version
_No response_
Contributor guide
Research direction
Start with the addComponent operation block in src/core/src/main/java/org/apache/jmeter/gui/tree/JMeterTreeModel.java and inspect getCurrentGui there. Trace the proxy recording path in src/protocol/http/src/main/java/org/apache/jmeter/protocol/http/proxy/ProxyControl.java, then reproduce with many queued requests; done means the focused UI is not recreated for every addition and is updated after the batch.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- desktop, performance
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100