Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-3612

Add Python C extension for compact protocol

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.10.0
    • Component/s: None
    • Labels:
      None

      Description

      I've extracted fastbinary.c TBinary implementation to a C++ class and added TCompact counter part.
      It can be used in the same way as TBinaryProtocolAccelerated.
      Note that it now requires C++ compiler but I don't think it affects anyone compiling Thrift Python module.

      Here's a quick benchmark:

      $ PYTHONPATH=lib/py/build/lib.linux-x86_64-2.7:test/py/gen-py \
          test/py/FastbinaryTest.py 
      
      Testing TBinaryAccelerated
      Starting Benchmarks
      HolyMoley Standard = 0.599830
      HolyMoley Acceler. = 0.028437
      FastStruct Standard = 0.151254
      FastStruct Acceler. = 0.010000
      
      Testing TCompactAccelerated
      Starting Benchmarks
      HolyMoley Standard = 1.200082
      HolyMoley Acceler. = 0.029162
      FastStruct Standard = 0.420377
      FastStruct Acceler. = 0.012183
      

      It's ~40x faster than pure python implementation, partly because pure-python TCompact is much slower than TBinary for some reason.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                nsuke Nobuaki Sukegawa
                Reporter:
                nsuke Nobuaki Sukegawa
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: