Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jdt-dev] Read access to enclosing field is emulated by a synthetic accesso r method. Increasing its visibility will improve your performance

I would say this can depend on the JIT optimization.
I would not be surprised if some JIT can inline the code directly which
means you don't pay for the extra method invocation.

The compiler warning is simply a to let the user know that this access to a
private method or variable can cause an extra method invocation.

Olivier



                                                                                                                                               
                      Gary Gregory                                                                                                             
                      <ggregory@seagull        To:       "'jdt-dev@xxxxxxxxxxx'" <jdt-dev@xxxxxxxxxxx>                                         
                      sw.com>                  cc:                                                                                             
                      Sent by:                 Subject:  [jdt-dev] Read access to enclosing field is emulated by a synthetic accesso r method. 
                      jdt-dev-admin@ecl         Increasing its visibility will improve your performance                                        
                      ipse.org                                                                                                                 
                                                                                                                                               
                                                                                                                                               
                      03/20/03 07:07 PM                                                                                                        
                      Please respond to                                                                                                        
                      jdt-dev                                                                                                                  
                                                                                                                                               
                                                                                                                                               




Hello All,


In some code I get eclipse compiler warnings like:


Read access to enclosing field GenericObjectPool._evictionCursor is
emulated by a synthetic accessor method. Increasing its visibility will
improve your performance    GenericObjectPool.java  Jakarta
Commons/pool/src/java/org/apache/commons/pool/impl      line 1005


I have created the attached test in order to see what improvements we are
talking about. I tried to make the test as simple as possible. On the JRE
1.4.1, sometimes but not always, using "a synthetic accessor method" is
slower, sometimes faster. Can you explain what is going on here? On JRE
1.3.1, the synthetic version is always slower (good). Can this be explained
away by GC? Or some other internal process?


Thank you,
Gary


Eclipse Platform
Version: 2.1.0
Build id: 200303071024


Test results:


Running Java 1.3.1_07-b02 on Windows XP 5.1 null


iterations = 1000
withWarningMsecs = 0
noWarningMsecs = 0
no difference


iterations = 10000
withWarningMsecs = 10
noWarningMsecs = 0
no warning class is faster by 10 msecs


iterations = 100000
withWarningMsecs = 10
noWarningMsecs = 0
no warning class is faster by 10 msecs


iterations = 1000000
withWarningMsecs = 30
noWarningMsecs = 20
no warning class is faster by 10 msecs


iterations = 10000000
withWarningMsecs = 290
noWarningMsecs = 241
no warning class is faster by 49 msecs


iterations = 100000000
withWarningMsecs = 2663
noWarningMsecs = 2354
no warning class is faster by 309 msecs


Done.


----------------------------------------------------------


Running Java 1.4.1_02-b06 on Windows XP 5.1 Service Pack 1


iterations = 1000
withWarningMsecs = 10
noWarningMsecs = 0
no warning class is faster by 10 msecs


iterations = 10000
withWarningMsecs = 0
noWarningMsecs = 0
no difference


iterations = 100000
withWarningMsecs = 10
noWarningMsecs = 10
no difference


iterations = 1000000
withWarningMsecs = 90
noWarningMsecs = 90
no difference


iterations = 10000000
withWarningMsecs = 811
noWarningMsecs = 821
no warning class is SLOWER by 10 msecs


iterations = 100000000
withWarningMsecs = 8152
noWarningMsecs = 8092
no warning class is faster by 60 msecs


Done.









Back to the top