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 28066 - Tuning opportunities in the Settings area
Summary: Tuning opportunities in the Settings area
Status: CLOSED FIXED
Alias: None
Product: projects
Classification: Unclassified
Component: Generic Infrastructure (show other bugs)
Version: 3.x
Hardware: All All
: P3 blocker (vote)
Assignee: Vitezslav Stejskal
URL:
Keywords: PERFORMANCE
Depends on:
Blocks:
 
Reported: 2002-10-17 06:36 UTC by Torbjorn Norbye
Modified: 2004-04-19 16:39 UTC (History)
0 users

See Also:
Issue Type: TASK
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Torbjorn Norbye 2002-10-17 06:36:24 UTC
I've noticed some things in the Settings area
which may cause performance problems; before doing
anything measurements should confirm that these
are problems; but in any case I wanted to record
them before I forget all about it:

(1) Exceptions used for control flow. This is
considered bad;     exceptions should be used for
unexpected failures, not to     communicate
"return values". (See Effective Java for
justification; also, I seem to remember that we
found that part of NetBeans' long startup time had
to do with the JDK throwing thousands of
exceptions when computing the font path.)

To be specific; NameNotFound exception is used
whenever we look up setting values and it's not
defined. For ProxyContext, this means that a
single lookup causes a series of exceptions to be
thrown. (And when exceptions are thrown, the vm
has to record stack information etc which is costly.)

I don't know if we can do anything about this
since this is part of the Context API from JNDI,
but perhaps there's something we can do about
this; either document that a null return value
means name not found (which means you can't store
null as the value, which is probably acceptable
since in most project settings cases the treatment
of the two are identical), or perhaps we can think
of something even better.

(2) Right now we're adding more contexts into the
proxy context than is necessary; we're adding in
ALL the contexts (defaults, different
configuration types, etc.) because
TreeNodeContext.computeContexts() doesn't know
which specific name we're looking for. It could be
enhanced to lazily only compute the contexts
relevant to the specific name.

(3) In some cases we're adding in empty contexts
(Context.empty). You can end up with multiple of
these. I presume this was done for simplicity (the
delegates array has already been sized?). But in
any case it seems like having a 0-sized array
(when there are no delegates) or simply leaving
out Context.EMPTY would be better (fewer lookup
operations to be called).

(4) We've added (well, I haven't putback yet)
Defaults folders which can hold default values for
configuration types. This means that there are
additional contexts to be searched when doing
lookup. An alternative to this would be to -copy-
default values into a project when it's created
from the Defaults folders provided by the natures.
This will make lookup faster. It will however also
make the project files larger. It has the
"disadvantage" that if the defaults change in the
future, the project still uses the old ones - but
that can also be viewed as an advantage
(predictable builds).

(5) To compute contexts (computeContexts()) we use
the configuration manager, which returns
Configuration[] objects; these have their display
names etc. initialized. This is overkill for what
we need; which is simply to walk over the
configuration type folder and pick out active
contexts. It might be beneficial to add some
convenience methods to the ConfigurationManager
which provides Context objects for the active
configurations (and internally doesn't fully
initialize the configuration objects but uses its
internal knowledge of how the PFS is laid out to
compute the results.)

(6) The value notification of changes causes LOTS
of event objects to be created - this is because
it's using the standard JNDI notification scheme.
It might be possible to do something more efficient.


I think I had a few more ideas but they seem to
have vanished. I'll add them later if they come back.
Comment 1 Vitezslav Stejskal 2002-10-17 13:03:10 UTC
I would add one more think:

(7) Cache for dependencies between ProjectMemebers used for
calculating settings hiereachy should do real caching, not just
delegate to DependencyProviders.

Comment 2 Vitezslav Stejskal 2003-01-02 16:27:44 UTC
ad #2: This is already solved the TNC has been split and all the code
which deals with reading/writing settings from/to specific
configuration has been separated to ConfigurationContext. The TNC adds
to ProxyContext only those contexts involved in the dependency tree of
ProjectMember which the TNC is created for.

ad #5: Since the configurations became a part of public API this issue
is hard to implement. It would make the API less intuitive and hard to
use. Anyway, it's not big deal as the data kept by Configuration
object are really small and there is always only a few configurations
in the project.

ad #6: Events handling has been reimplemented as a part of TNC
refactoring. It tries to be as effective as possible always firing
named events and only those which are neccessary. However, there are
still several issues in filesystem and settings framework
(InstanceDataObject) which fire unneccessary events, but their
solution is outside of the projecs implementation scope. These issues
have been filed separately.
Comment 3 Vitezslav Stejskal 2003-06-05 12:52:47 UTC
The #4 is non-issue now, new configuration is always created as a copy
of existing one. There is no support for defining defaults for
ConfigurationType.

#1 - will be solved by rewriting settings infrastructure to use new
Registry API (see issue #32660), this can be considered as non-issue too.
Comment 4 Vitezslav Stejskal 2003-06-05 13:04:11 UTC
The rest issues are filed separately #3 - issue #34199 and #7 - issue
#34200. Closing this one.
Comment 5 Jan Becicka 2003-11-25 14:01:59 UTC
As described in
http://www.netbeans.org/servlets/ReadMsg?msgId=619519&listName=nbdiscuss the
current work on projects prototype has been stopped.

Marking issue as VERIFIED --->
Comment 6 Jan Becicka 2003-11-25 14:10:47 UTC
---> CLOSED