This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 249864 - ETable::updatePreferredWidths is a major performance drag for large tables
Summary: ETable::updatePreferredWidths is a major performance drag for large tables
Status: NEW
Alias: None
Product: platform
Classification: Unclassified
Component: Outline&TreeTable (show other bugs)
Version: 8.0.2
Hardware: PC Mac OS X
: P3 normal (vote)
Assignee: Martin Entlicher
Depends on:
Reported: 2015-01-16 15:32 UTC by smowton
Modified: 2015-01-16 15:32 UTC (History)
0 users

See Also:
Exception Reporter:


Note You need to log in before you can comment on or make changes to this bug.
Description smowton 2015-01-16 15:32:55 UTC
I'm using Gephi, which when faced with a large dataset tries to create a very large Outline table. For example, my testcase features 10,000,000 rows.

In this case, most of the time consumed presenting the table (through ETable::setModel) is consumed running ETable::updatePreferredWidths, which is costly as it uses reflection to create a renderer for and layout every cell in the table.

Obviously a very large table is fairly unusual, but the cost can easily be made tolerable at the Netbeans level: instead of sampling *every* row of a large table, with the user's permission just sample 10,000 rows, from the start, from the end, randomly, whatever. I hacked it to just use the first 10,000 rows if the table is longer than that, and the time spent stalled waiting for the AWT event thread is reduced by ~90%.

Obviously picking a fixed threshold like that is a bit of a mess. Alternatively, add a flag to disable this expensive operation entirely; users can then implement their own column width logic as they see fit. Call it ETable::setAutoColumnPreferredWidth(boolean) or something.

Alternatively, change updatePreferredWidths to a protected method, so that users can override it gracefully -- at the moment I have to subclass Outline, subclass OutlineColumn within it, copy-and-paste ETableColumn::estimatedWidth and ETableColumn::updatePreferredWidth amongst others, and finally override the public method ETable::setModel in order to disable the expensive calculation.