You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Kyle Phelps (JIRA)" <ji...@apache.org> on 2018/12/06 20:12:00 UTC

[jira] [Updated] (AVRO-2281) Performance improvement in ruby binary decoder and encoder

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

Kyle Phelps updated AVRO-2281:
------------------------------
    Status: Patch Available  (was: Open)

> Performance improvement in ruby binary decoder and encoder
> ----------------------------------------------------------
>
>                 Key: AVRO-2281
>                 URL: https://issues.apache.org/jira/browse/AVRO-2281
>             Project: Apache Avro
>          Issue Type: Improvement
>          Components: ruby
>    Affects Versions: 1.9.0
>            Reporter: Kyle Phelps
>            Priority: Minor
>
> The ruby binary decoder has some inefficient memory usage patterns. The decoding process relies on `unpack` quite heavily, but it allocates an array that is not used as we just access the first element of the result. In ruby 2.4 we can use the optimized version of this, `unpack1` which avoids allocating the unused array. In `byte!`, we can go one step further and just use the `readbyte` method provided by the IO module - this improves the performance of `byte!` by about 50%. Additionally, there are a few strings in the encoder and decoder that should be frozen to reduce unnecessary string allocations.
>  
> With these changes, I've seen about a 20% performance improvement when decoding.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)