Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make compaction available for
Oj::Doc
(#650)
* 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> * 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> * 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> * Apply formatting rules for every c files Signed-off-by: Ulysse Buonomo <buonomo.ulysse@gmail.com>
- Loading branch information
Showing
55 changed files
with
10,584 additions
and
10,211 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
BasedOnStyle: Mozilla | ||
IndentWidth: 4 | ||
BreakBeforeBraces: Attach | ||
ColumnLimit: 0 | ||
AlwaysBreakAfterReturnType: AllDefinitions | ||
DerivePointerAlignment: false | ||
PointerAlignment: Right |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -92,4 +92,3 @@ begin | |
|
||
rescue LoadError | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.