perf(profiler): lazily construct Swing UI in editors used for server-side table rendering - #38
Open
szhatchenko wants to merge 1 commit into
Open
szhatchenko wants to merge 1 commit into
szhatchenko wants to merge 1 commit into
Conversation
…side table rendering WebTablesProvider.getEditableControlCode instantiates a PropertyEditor for every editable cell and only reads getTags()/getAsText(). But editors inherited from the desktop UI eagerly built their Swing components at construction time: - GenericComboBoxEditor allocated a JComboBox (and its UI) in a field initializer on every instantiation. - FormulaEditor (TextButtonEditor) allocated a JTextField/JLabel and installed its button icon in the constructor. On the server this ran for each editable cell of each dataTables request, constructing full Swing component trees (UI delegates, popups, scrollbars) that are then discarded. Lazily allocate these components: JComboBox is built in createComponent (where it was already being rebuilt anyway), JLabel in the FormulaEditor constructor and setValue is guarded. Behavior is unchanged for the desktop path (the fields are still set on construction); only the server path, which never renders the component, is spared the cost. Co-Authored-By: Claude Code <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Optimizations based on async-profiler analysis from https://biouml2test.biouml.org (the server URL provided by the user).
Profiles Analyzed
What the profiles show
The dominant cost in both profiles is not application code — it is the JDK C2
JIT compiler threads (PhaseChaitin::Register_Allocate, GraphBuilder, Parse, …):
114/143 samples (79.7%) in one and 136/156 (87.2%) in the other. That is a
cold-start/warm-up window where the JVM is compiling the very methods the server
is first exercising; it is not a steady-state hot path and there is nothing to
change in BioUML to reduce it.
The sub-process log (action=subProcessLog) returned 0 records, confirming the
work was in-JVM rather than in an external R/Nextflow/perl process.
Within the remaining application samples, the single clear, recurring, and
actionable hot path is server-side dataTables rendering:
WebTablesProvider.sendTableData → getEditableControlCode instantiates a
PropertyEditor for every editable cell and only reads getTags()/getAsText().
Those editors, however, eagerly built full Swing component trees at
construction time.
Top application hot functions (excluding JIT-compiler threads)
Changes
Net effect: the server-side getEditableControlCode path (which only reads getTags()) no longer constructs a Swing component tree per editable cell. Desktop behavior is unchanged — the same components are created on construction.
Verification
🤖 Generated with Claude Code
Co-Authored-By: Claude Code noreply@anthropic.com