Uploaded image for project: 'Apache Avro'
  1. Apache Avro
  2. AVRO-1260

Ruby: Performance improvements for parsing

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.7.3
    • 1.7.5
    • ruby
    • None

    Description

      I've made a few performance improvements to the Ruby Avro decoder. In my tests (decoding a complex record with many fields and nested records), I saw a 40% speedup on MRI 1.8.7 and a 20% speedup on MRI 1.9.3. The improved code also makes about half as many object allocations as before.

      Main changes are:

      • Using symbols instead of strings for the various schema types (there was actually a FIXME in the code for this, now fixed)
      • Added a few memoizations to avoid unnecessarily recomputing values

      I've tried to keep the API unchanged — Avro::Schema#type still returns a string, as users may be relying on the type (Avro::Schema#type_sym has the symbolized version). So I don't think this patch introduces any compatibility problems (as long as apps aren't relying on internals of the Avro library).

      Attachments

        1. AVRO-1260.patch
          25 kB
          Martin Kleppmann
        2. AVRO-1260-2.patch
          23 kB
          Martin Kleppmann

        Activity

          People

            martinkl Martin Kleppmann
            martinkl Martin Kleppmann
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: