You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@olingo.apache.org by "Michael Bolz (JIRA)" <ji...@apache.org> on 2015/01/28 08:20:35 UTC

[jira] [Updated] (OLINGO-421) java client - further improve getter method's perf in the generated proxy codes

     [ https://issues.apache.org/jira/browse/OLINGO-421?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael Bolz updated OLINGO-421:
--------------------------------
    Fix Version/s:     (was: (Java) V4 4.0.0-beta-02)
                   (Java) V4 4.0.0-beta-03

> java client - further improve getter method's perf in the generated proxy codes
> -------------------------------------------------------------------------------
>
>                 Key: OLINGO-421
>                 URL: https://issues.apache.org/jira/browse/OLINGO-421
>             Project: Olingo
>          Issue Type: Task
>          Components: odata4-client
>    Affects Versions: (Java) V4 4.0.0-beta-02
>            Reporter: Challen
>            Assignee: Challen
>             Fix For: (Java) V4 4.0.0-beta-03
>
>         Attachments: 0001-proxy-code-time-the-getxxx-method-with-.t1-.t3.patch
>
>
> OLINGO-415 did enhanced the getter method's perf, but further improvement is still expected. (it may be a significant code change, so targetting beta-02)
> in a test, t3 (620) is only half of t2 (1240), so the invoke() method still can be optimized.
> (in AbstractStructuredInvocationHandler.java)
> ====================
>    public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable {
> +  	long start1 = System.nanoTime();
>    	if (method.getName().startsWith("get")) {  
>    		// Here need check "get"/"set" first for better get-/set- performance because
>    		// the below if-statements are really time-consuming, even twice slower than "get" body.
>  
>    		// Assumption: for each getter will always exist a setter and viceversa.
>        // get method annotation and check if it exists as expected
>  
> +      long start2 = System.nanoTime();
>        final Object res;
>        final Method getter = typeRef.getMethod(method.getName());
>  
>        final Property property = ClassUtils.getAnnotation(Property.class, getter);
>        if (property == null) {
>          final NavigationProperty navProp = ClassUtils.getAnnotation(NavigationProperty.class, getter);
>          if (navProp == null) {
>            throw new UnsupportedOperationException("Unsupported method " + method.getName());
>          } else {
>            // if the getter refers to a navigation property ... navigate and follow link if necessary
>            res = getNavigationPropertyValue(navProp, getter);
>          }
>        } else {
>          // if the getter refers to a property .... get property from wrapped entity
>          res = getPropertyValue(property.name(), getter.getGenericReturnType());  // inside, ClassUtils.t3 is measured 
>        }
>  
> +      ClassUtils.t2 += System.nanoTime() - start2;
> +      ClassUtils.t1 += System.nanoTime() - start1;
> ( ClassUtils.t3 is measured in  getPropertyValue() method. )
> ========================
> +          	long start3 = System.nanoTime();
>              res = property == null || property.hasNullValue()
>                      ? null
>                      : CoreUtils.getObjectFromODataValue(property.getValue(), type, service);
> +            ClassUtils.t3 += System.nanoTime() - start3;



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)