tajo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hyunsik Choi (JIRA)" <j...@apache.org>
Subject [jira] [Created] (TAJO-95) Eliminate the laze copy approach from the classes wrapping protobuf-generated classes.
Date Fri, 26 Jul 2013 12:23:48 GMT
Hyunsik Choi created TAJO-95:
--------------------------------

             Summary: 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: Hyunsik Choi


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.
Especially, this problem becomes more complicated if the wrapper class can be (de)serialized
via both JSON and protocol buffer.

{code:title=A wrapper class}
  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