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 188213 - Font dialog "Taking inventory of fonts" taking a very long time.
Summary: Font dialog "Taking inventory of fonts" taking a very long time.
Status: REOPENED
Alias: None
Product: cnd
Classification: Unclassified
Component: Terminalemulator (show other bugs)
Version: 6.x
Hardware: Macintosh (x86) Mac OS X
: P4 normal with 2 votes (vote)
Assignee: ilia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-29 18:33 UTC by tbergeron
Modified: 2015-02-24 09:42 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Profiling select terminal font (16.50 KB, application/octet-stream)
2012-04-24 19:03 UTC, ducngtuan
Details
Profiling select terminal font (74.45 KB, application/zip)
2012-04-24 22:09 UTC, ducngtuan
Details
do font API timings (1.97 KB, application/octet-stream)
2012-07-08 20:45 UTC, ivan
Details

Note You need to log in before you can comment on or make changes to this bug.
Description tbergeron 2010-06-29 18:33:41 UTC
I tried to change my Terminal (experimental feature) font when I stumbled upon this super-slow progress dialog.

I have about 250 fonts on my computer, so I don't really think it's a problem due to a "huge" font library.

I don't have nothing special on this installation.
Comment 1 Vladimir Yaroslavskiy 2010-07-02 12:51:21 UTC
Why is print category? Please, provide detailed steps to reproduce. It looks like that this issue doesn't belong to Print / Print Preview functionality in NetBeans.
Comment 2 tbergeron 2010-07-05 17:21:07 UTC
I started NetBeans 6.9, then I went to the Options, then clicked on Miscellaneous, then on on Terminal.

There, I clicked on ... (besides Font)

And then the dialog appeared and took a very very long time to complete.
Comment 3 Vladimir Yaroslavskiy 2010-07-05 17:58:07 UTC
Reassigning,
more probably it belongs to options/properties
Comment 4 Alexei Mokeev 2010-07-26 13:07:21 UTC
Moving to ide category. Please reassign appropriately to the category where terminal fonts customization is handled. Thanks.
Comment 5 Alexander Simon 2012-04-20 11:43:14 UTC
fixed long ago when bug #185154 was fixed
Comment 6 Alexander Simon 2012-04-20 12:01:53 UTC
Clarifying: fixed UI freezing.
If you mean long progress without UI freezing, it is not a bug (it is an your environment artifact).
Comment 7 ducngtuan 2012-04-24 17:01:40 UTC
(In reply to comment #6)
> Clarifying: fixed UI freezing.
> If you mean long progress without UI freezing, it is not a bug (it is an your
> environment artifact).

I would like to have this "feature" fixed or deactivated by default. If this is not a bug, I would consider it a very unwanted feature!

For me it took about more than 10 minutes to finished looking through my fonts library (which has only default Mac OS fonts). When I unchecked the box "Listing only fixed width fonts", that process started again. And after that, when I was trying to select another font for my terminal, the process started unexpectedly again.

For all these time the IDE cannot be used, all I could do was watching and waiting for that process to be done.

I'm using Netbeans 7.1.1, Mac OS Lion 10.7.3 and JDK 6.
Comment 8 Alexander Simon 2012-04-24 18:08:27 UTC
Please attach profiling snapshot.
Comment 9 ducngtuan 2012-04-24 19:03:56 UTC
Created attachment 118707 [details]
Profiling select terminal font

I did the profiling three times, but couldn't get the progress to 100%. It stopped at about 50% because of some missing font (Error Message: Font XYZ is missing, use Monospaced").

For NB7.1: The process dialog can be stopped now (click on "Cancel" button), but still take a strange amount of time (5-6 mins for 50%).

Hope you get it fixed, or can just remove this feature!
Comment 10 Alexander Simon 2012-04-24 19:10:04 UTC
Is the same behavior observer in Fonts&Colors->Syntax->Font?
Comment 11 ducngtuan 2012-04-24 19:11:58 UTC
(In reply to comment #10)
> Is the same behavior observer in Fonts&Colors->Syntax->Font?

No, i have only seen this behavior when select terminal font.
Comment 12 Alexander Simon 2012-04-24 19:17:25 UTC
What is your JDK version?
Comment 13 ducngtuan 2012-04-24 19:19:51 UTC
(In reply to comment #12)
> What is your JDK version?

java version "1.6.0_31"
Java(TM) SE Runtime Environment (build 1.6.0_31-b04-415-11M3635)
Java HotSpot(TM) 64-Bit Server VM (build 20.6-b01-415, mixed mode)

Mac OS X 10.7.3, NetBeans IDE 7.1.1
Comment 14 ivan 2012-04-24 20:36:30 UTC
a) There's another font chooser dialog that requires filtering
   by fixed width. See if it also has similar problems.
   That dialog can be reached by opening any generic output window (say
   an ant build window) and choosing "Choose Font" from it's context
   menu.
b) If you have trouble getting the builtin profiler to work try 
   "by hand" thread snapshots using ^\ on the console where you
   started NetBeans or using JavaConsole. If it's taking 10 minutes
   a few samplings should give us a picture.
Comment 15 ducngtuan 2012-04-24 21:39:35 UTC
(In reply to comment #14)

a) Other font dialogs don't have this option (no checkbox and no filtering process). For example: Output Windows -> Choose Font, this dialog is the same as Syntax Font (Preferences -> Fonts&Colors -> Syntax -> Font)

b) I don't have problem with profiler, I couldn't profile the total filtering process because the filtering process was broken / stopped at ~50%, not the profiler itself.
Comment 16 ivan 2012-04-24 21:44:22 UTC
(In reply to comment #15)
> (In reply to comment #14)
> 
> b) I don't have problem with profiler, I couldn't profile the total filtering
> process because the filtering process was broken / stopped at ~50%, not the
> profiler itself.

Can you attach the profile which you got for the first %50 anyway?
Comment 17 ducngtuan 2012-04-24 22:09:19 UTC
Created attachment 118717 [details]
Profiling select terminal font

I tried again but the filter process did not complete. It stopped about 50%, and return an error "Font missing, use Monospaced". The reason maybe because I choose the font "Menlo" for terminal at the moment, and in the font list it is at the middle position.

I include 3 other profile example (1, 2 und 4) which i took with profiler. All of them is only for 50%. More over I have realized that the time in the profiling not correct. Start time in report is about 2-3 mins later than the actual time i started the profiler.

I also included some sample I got manually with the ^\ tip. Hope this help.
Comment 18 ivan 2012-04-24 22:21:26 UTC
(In reply to comment #17)
> 
> I also included some sample I got manually with the ^\ tip. Hope this help.

Great. They clearly demonstrate that the time is spent in FontMetrics.getWidths().

Alexander can you please send a sample code as I suggested to verify that
getWidths() returns 156 items.

The output window also has a fixed width font restriction so we could
take a look at it's font chooser and see if it has a faster trick.
Comment 19 ivan 2012-04-24 22:23:04 UTC
Oh yeah forgot ... I checked the Java bug database so
pathological slowness of getWidth() is reported on Mac's
or any other platforms.

The code snippet should also double-check that the number of font
family names isn't too many as well.
Comment 20 Vladimir Voskresensky 2012-04-25 07:35:59 UTC
please, provide full Help->About info
Comment 21 ducngtuan 2012-04-25 07:39:33 UTC
(In reply to comment #20)
> please, provide full Help->About info
Do you mean this:

Product Version: NetBeans IDE 7.1.1 (Build 201203012225)
Java: 1.6.0_31; Java HotSpot(TM) 64-Bit Server VM 20.6-b01-415
System: Mac OS X version 10.7.3 running on x86_64; MacRoman; de_DE (nb)
User directory: /Users/ducnguyen/.netbeans/7.1.1
Cache directory: /Users/ducnguyen/.netbeans/7.1.1/var/cache
Comment 22 Vladimir Voskresensky 2012-04-25 11:01:31 UTC
Thanks for info. We will try to do something with this. And thanks for your cooperation!
Comment 23 Vladimir Voskresensky 2012-04-25 15:08:10 UTC
We've discussed a little.
What if this progress activity would not be uninterruptable? I.e. we can do it non modal (progress can be part of dialog itself), so selection of font is not blocked by this activity. Ok/Cancel will be available.
Comment 24 ducngtuan 2012-04-25 16:00:05 UTC
(In reply to comment #23)
> We've discussed a little.
> What if this progress activity would not be uninterruptable? I.e. we can do it
> non modal (progress can be part of dialog itself), so selection of font is not
> blocked by this activity. Ok/Cancel will be available.

I want to clarify the situation:
- For Netbeans 6.9 (when I first voted on this problem): The font chooser dialog called another dialog with progressbar, which shows the filtering process. This dialog had, as i remembered, no "Cancel" Button, and I could not stop/break the filtering process manually, and had to wait.

- For Netbeans 7.1 (the version I'm using at the moment): The filter dialog has now a "Cancel" button, I can already manually break/stop the filtering process and don not have to wait for the process to finish.

Anyway, because this filtering process takes so much time, and seems to be buggy, I think it should be fixed or just removed. Why don't you use the same font chooser dialog like the one for Output windows or for Syntax (Preferences -> Font&Color -> Syntax -> Font), which doesn't has this filter option and doesn't invoke such process?
Comment 25 Egor Ushakov 2012-05-18 08:01:49 UTC
I agree that this needs to be fixed, but as long as it does not break the IDE and has a workaround (just cancel the process) - as a P4.
Comment 26 markuszeller 2012-07-08 16:15:32 UTC
I can confirm this. It takes many minutes and is absolutely inacceptable.
Currently, running 15 minutes and not even having around 10%, yet.

One minute would be quite okay by my amount of fonts are beeing installed.

For your details:
OSX Lion, 713 Fonts installed
Comment 27 ivan 2012-07-08 20:44:21 UTC
OK, let's get to the bottom of this.

I'll be adding a small java program source as an attachment.
Please build and run it as follows:
    $ javac FontTester.java
    $ java FontTester
It will pop up a teeny window which might appear in the corner
and if you run it from the cmdline you'll need to ^C it when it's done.

Here's how the beginning of it looks on my machine:

bash@A: java FontTester 
	TgetAvailableFontfamilyNames: 0
Querying 41 fonts ...
Querying font 'AR PL ShanHeiSun Uni'
	TgetFontMetrics: 0  TgetWidths: 0
	Is NOT fixed-width
...

It's got timings for all jdk calls and a check if FontMetrics.getWidths()
actually returns less than 256 items.
Comment 28 ivan 2012-07-08 20:45:17 UTC
Created attachment 121809 [details]
do font API timings