Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make compaction available for Oj::Doc #650

Merged
merged 4 commits into from Apr 8, 2021

Commits on Apr 7, 2021

  1. reformat fast.c

    Formatting done using VSCode's C extension and using tabular indent.
    
    https://lea.verou.me/2012/01/why-tabs-are-clearly-superior/
    
    Signed-off-by: Ulysse Buonomo <buonomo.ulysse@gmail.com>
    BuonOmo committed Apr 7, 2021
    Copy the full SHA
    34df54c View commit details
    Browse the repository at this point in the history
  2. Make compaction available for Oj::Doc

    Introduce compaction to `fast.c`, only if `rb_gc_mark_movable` is
    available. Otherwise, keep a version that supports ruby <2.7.
    
    Since `rb_data_object_wrap` and `TypedData_Wrap_Struct` is available
    in every supported versions (eg >=2.4.10), I've also removed support
    for earlier versions.
    
    Result for compaction is great. I've tested it by allocating and
    removing arbitrary sized json. For a count of 70 pages, we can see
    that we used to need 68 pages after compaction,and now 61 pages. Of
    course this test include also lots of noise, but if we count pinned
    objects (objects that are marked in C extension as uncollectible),
    we can see that for a benchmark with no allocations, we have the
    same amount as a benchmark with this commit with thousands of allocations
    (499 pinned objects total), and before this, `Oj::Doc` used to generate
    5k more objects (5499 pinned objects total).
    
    Hence this is a win, see PR for a graphical result.
    
    Signed-off-by: Ulysse Buonomo <buonomo.ulysse@gmail.com>
    BuonOmo committed Apr 7, 2021
    Copy the full SHA
    6e88d14 View commit details
    Browse the repository at this point in the history
  3. Fix formatting rules

    Using a `.clang-format` file, we fixed formatting rules to make sur they
    fit as much as possible current existing code, while still fixing spaces
    and tabs mixing issues.
    
    Signed-off-by: Ulysse Buonomo <buonomo.ulysse@gmail.com>
    BuonOmo committed Apr 7, 2021
    Copy the full SHA
    c097271 View commit details
    Browse the repository at this point in the history
  4. Apply formatting rules for every c files

    Signed-off-by: Ulysse Buonomo <buonomo.ulysse@gmail.com>
    BuonOmo committed Apr 7, 2021
    Copy the full SHA
    11cc133 View commit details
    Browse the repository at this point in the history