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

Summary: ETable::updatePreferredWidths is a major performance drag for large tables
Product: platform Reporter: smowton
Component: Outline&TreeTableAssignee: Martin Entlicher <mentlicher>
Status: NEW ---    
Severity: normal    
Priority: P3    
Version: 8.0.2   
Hardware: PC   
OS: Mac OS X   
Issue Type: ENHANCEMENT Exception Reporter:

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.