[jbosstools-issues] [JBoss JIRA] (JBIDE-20489) Performance issues of ELValidator and ELContextImpl

Alexey Kazakov (JIRA) issues at jboss.org
Sat Aug 22 00:04:26 EDT 2015


     [ https://issues.jboss.org/browse/JBIDE-20489?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexey Kazakov closed JBIDE-20489.
----------------------------------
    Resolution: Done


> Performance issues of ELValidator and ELContextImpl
> ---------------------------------------------------
>
>                 Key: JBIDE-20489
>                 URL: https://issues.jboss.org/browse/JBIDE-20489
>             Project: Tools (JBoss Tools)
>          Issue Type: Task
>          Components: common/jst/core
>    Affects Versions: 4.3.0.Beta2
>            Reporter: Viacheslav Kabanovich
>            Assignee: Viacheslav Kabanovich
>             Fix For: 4.3.0.CR1
>
>
> Create two large pages in a jsf project, with 1000-2000 tags and 1000-2000 expressions #{...}.
> Open both in editors. Now switch several times quickly between them and look at CPU in System Monitor.
> Processor will be heavily used for several minutes. As the computations are performed in a background thread, it is still possible to use Eclipse, but some operations may be put to wait for that thread and then Eclipse may hang for some time.
> There are several factors that cause this issue.
> 1. WTP's as-you-type validation at activating editor calls registered validators multiple times - once for each region; as calls are separated, there is no way to guess at the validator implementation that actually the entire content is to be revalidated once which could be done optimally, instead validator does a lot of validations without guarantee that previously computed context data may be safely reused.
> 2. ELValidator.validate(IValidator, ...) does complete job for each region. However, a lot of regions, are of no interest, since they contain no EL. It is very easy to improve performane by checking content for #{ and ${.
> 3. ELValidator.validate(IValidator, ...) every time creates new ELContext. While it works good at typing, when document is just changed, it becomes a huge waste of resources at opening editors and switching between them. This can be fixed by a document listener attached to the document of a file opened in an editor, the listener will dispose obsolete context, which can be reused until disposed.
> 4. ELContext holds the complete list of EL references, the EL validator and other clients request for subset of EL references by offset or region. Methods ELReference.getELReference(int) and ELReference.getELReference(IRegion) implement iteration over the entire list of available EL references. Together with (1) and (2) that gives number of operations of order (EL count)^2.
> 5. PageContextFactory.fillElReferencesForRegionNode() checks that a detected EL reference is not already added to ELContext by calling ELReference.getELReference(). Together with (3) it gives number of operations of order  (EL count)^2; and together with (1) and (2) it is (Region count) * (EL count)^2 - cubic dependency by file size.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


More information about the jbosstools-issues mailing list