tajo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Henry Saputra (JIRA)" <j...@apache.org>
Subject [jira] [Assigned] (TAJO-95) Eliminate the laze copy approach from the classes wrapping protobuf-generated classes.
Date Mon, 29 Jul 2013 18:03:50 GMT

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

Henry Saputra reassigned TAJO-95:
---------------------------------

    Assignee: Henry Saputra  (was: Hyunsik Choi)
    
> Eliminate the laze copy approach from the classes wrapping protobuf-generated classes.
> --------------------------------------------------------------------------------------
>
>                 Key: TAJO-95
>                 URL: https://issues.apache.org/jira/browse/TAJO-95
>             Project: Tajo
>          Issue Type: Improvement
>            Reporter: Hyunsik Choi
>            Assignee: Henry Saputra
>
> We have used two (de)serialization methods, such as JSON and Protocol Buffer. In a (de)
serializable object, each attribute can be placed on the  corresponding member variable or
the member variable of the protocol buffer object.
> For reducing the frequency of data copies, we have used the laze copy approach that delays
copying values from the contents of PB object to member variables or vice versa. It is similar
to copy-on-wrote (COW).
> In many cases, however, this mechanism is actually burden rather than the performance
benefit like the below code. Especially, this problem becomes more complicated if the wrapper
class can be (de)serialized via both JSON and protocol buffer.
> {code:title=a getter method based on the lazy copy approach}
>   protected TableDescProto proto = TableDescProto.getDefaultInstance();
>   protected TableDescProto.Builder builder = null;
>   protected boolean viaProto = false;
>   
>   @Expose protected String tableId;
>   @Expose protected Path uri;
>   @Expose protected TableMeta meta;
>    
>   .
>   .
>   public String getId() { // <- even a simple getter becomes very complicated.
>     TableDescProtoOrBuilder p = viaProto ? proto : builder;
>     
>     if (tableId != null) {
>       return this.tableId;
>     }
>     if (!p.hasId()) {
>       return null;
>     }
>     this.tableId = p.getId();
>     
>     return this.tableId;
>   }
> {code}
> Therefore, I would like to propose the simplification of wrapper classes by eliminating
the laze copy approach. My proposal is as follows:
>  * A wrapper class only keeps values in member variables when it is created.
>  * A wrapper class only builds the corresponding protobuf object when getProto() is called.
> I think that the performance benefit has been very low. We should remove the lazy copy
approach for more robust system.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message