bytedance / sonic-cpp

A fast JSON serializing & deserializing library, accelerated by SIMD.
Apache License 2.0
835 stars 101 forks source link

opt: use customized memcpy #31

Closed liuq19 closed 1 year ago

liuq19 commented 1 year ago

Main Changes

  1. avoid function calls, std::memcpy may cause function calls
  2. use loop unrolled simd memcpy

Benchmarks

Benchmark                                Time             CPU      Time Old      Time New       CPU Old       CPU New
---------------------------------------------------------------------------------------------------------------------
lottie/Decode_SonicDyn                -0.0855         -0.0855        550518        503448        550519        503448
liuq19 commented 1 year ago

Full Benchmarks

Benchmark                                        Time             CPU      Time Old      Time New       CPU Old       CPU New
-----------------------------------------------------------------------------------------------------------------------------
book/Decode_SonicDyn                          -0.0444         -0.0444           686           655           686           655
twitter/Decode_SonicDyn                       -0.0242         -0.0242        128137        125033        128137        125032
poet/Decode_SonicDyn                          -0.0278         -0.0278        984941        957563        984943        957564
canada/Decode_SonicDyn                        -0.0239         -0.0238       2507680       2447828       2507268       2447524
github_events/Decode_SonicDyn                 -0.0279         -0.0279         29293         28475         29293         28475
lottie/Decode_SonicDyn                        -0.0887         -0.0888        568007        517635        567987        517543
otfcc/Decode_SonicDyn                         -0.0329         -0.0329     156349957     151207864     156350346     151208007
citm_catalog/Decode_SonicDyn                  -0.0427         -0.0426        771730        738767        771618        738768
twitterescaped/Decode_SonicDyn                -0.0079         -0.0079        346349        343607        346342        343603
fgo/Decode_SonicDyn                           +0.0010         +0.0011      57991690      58049334      57980160      58043513
gsoc-2018/Decode_SonicDyn                     -0.0098         -0.0098        799920        792088        799921        792089