[ 
https://issues.apache.org/jira/browse/AVRO-327?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12800832#action_12800832
 ] 

Thiruvalluvan M. G. commented on AVRO-327:
------------------------------------------

The code snippet would be something like:

The examples assume that readAvro(Decoder d) and readNonAvro(InputStream in) 
are given.

Example 1:
{code:|borderStyle=solid}


class  XXX {
    private ValidatingDecoder d = new ValidatingDecoder(schema, new 
BinaryDecoder(null));
    void readAvro(InputStream in) {
        d.init(in);
        readAvro(d);
        readNonAvro(in);
    }
}

v.

class  XXX {
    BinaryDecoder bd = new BinaryDecoder(null);
    InputStream wrap = new BinaryDecoderInputStream(bd);
    private ValidatingDecoder d = new ValidatingDecoder(schema, bd);
    void readAvro(InputStream in) {
        d.init(in);
        readAvro(d);
        readNonAvro(wrap);
    }
}
{code}
Example 2:

{code:|borderStyle=solid}

void f(InputStream in) {
    AvroObject o = readAvro(in);
    NonAvroObject no = readNonAvro(in);
}

void readAvro(InputStream in) {
   return readAvro(new BinaryDecoder(in));
}

v.

public Pair {
    AvroObject first;
    InputStream second;
}

void f(InputStream in)  {
    Pair<AvroObject, InputStream> p = readAvro(in);
    NonAvroObject no = readNonAvro(p.second);
}

Pair readAvro(InputStream in) {
    BinaryDecoder d = new BinaryDecoder(in);
    AvroObject o = readAvro(d);
    return new Pair(o, new BinaryDecoderInputStream(d));
}

{code}

> Performance improvements to BinaryDecoder.readLong()
> ----------------------------------------------------
>
>                 Key: AVRO-327
>                 URL: https://issues.apache.org/jira/browse/AVRO-327
>             Project: Avro
>          Issue Type: Improvement
>          Components: java
>            Reporter: Thiruvalluvan M. G.
>            Assignee: Thiruvalluvan M. G.
>
> AVRO-315 proposed performance improvements to readLong(), readFloat() and 
> readDouble(). readLong() did not improve performance well for all. Scott 
> proposed a better method (but requires a change in semantics and API). We'll 
> carry on the discussion on that proposal here. AVRO-315 will be committed 
> with changes for readFloat() and readDouble().

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to