Thank you for you answer. However I underline that the extra time observed
when accessing ServiceProperty fields doesn't comes from the profiler (I
used the NetBeans Profiler). Below is a short test :

package felixtest.impl;

import felixtest.services.SimpleService;
import org.apache.felix.ipojo.annotations.Component;
import org.apache.felix.ipojo.annotations.Provides;
import org.apache.felix.ipojo.annotations.ServiceProperty;

@Component
@Provides
public class SimpleImplementation implements SimpleService {

    @ServiceProperty(name = REAL_VALUE)
    double k;
    @ServiceProperty(name = LOOPS_NUMBER)
    int n;
    
    @Override
    public void computeSlow() {
        double res;
        for (int i = 0; i < n; ++i) {
            res = k * i;
        }
    }
    @Override
     public void computeFast() {
        double res,k0=k,n0=n;
        for (int i = 0; i < n; ++i) {
            res = k0 * i;
        }
    }   
}

As you can see the « computeSlow » method reads n and k for each loop. 10E6
loops give me a total run time around 9 secondes, while « computeFast »
accessing only n in the if test is around 3 seconds.
Even worth, when I replaced within that last method n in the if test by n0
the total time is 17 microSeconds !!! 
This of course is not good, and if I must  introduced local variables I will
felt like in the bad old time when creator or methods should hold a long
list of meaningless parameters.
Best regards,

JP



--
View this message in context: 
http://apache-felix.18485.x6.nabble.com/ipojo-performance-tp5021814p5021879.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@felix.apache.org
For additional commands, e-mail: users-h...@felix.apache.org

Reply via email to