dmlc / treelite

Universal model exchange and serialization format for decision tree forests
https://treelite.readthedocs.io/en/latest/
Apache License 2.0
730 stars 98 forks source link

Clean up serialization logic #507

Closed hcho3 closed 1 year ago

hcho3 commented 1 year ago

Clean up the serialization logic using mix-in classes. Closes https://github.com/dmlc/treelite/issues/478. Now all the serialization logic lives in src/serializer.cc.

I broke up #506 to make it easy to review.

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 86.91% and project coverage change: +0.23 :tada:

Comparison is base (0640b75) 82.86% compared to head (950a814) 83.09%.

:exclamation: Current head 950a814 differs from pull request most recent head 6c511a5. Consider uploading reports for the commit 6c511a5 to get more accurate results

Additional details and impacted files ```diff @@ Coverage Diff @@ ## v4 #507 +/- ## ========================================== + Coverage 82.86% 83.09% +0.23% ========================================== Files 58 60 +2 Lines 6208 5561 -647 Branches 383 0 -383 ========================================== - Hits 5144 4621 -523 + Misses 1064 940 -124 ``` | [Impacted Files](https://app.codecov.io/gh/dmlc/treelite/pull/507?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dmlc) | Coverage Δ | | |---|---|---| | [include/treelite/detail/contiguous\_array.h](https://app.codecov.io/gh/dmlc/treelite/pull/507?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dmlc#diff-aW5jbHVkZS90cmVlbGl0ZS9kZXRhaWwvY29udGlndW91c19hcnJheS5o) | `89.83% <ø> (+1.25%)` | :arrow_up: | | [include/treelite/tree\_impl.h](https://app.codecov.io/gh/dmlc/treelite/pull/507?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dmlc#diff-aW5jbHVkZS90cmVlbGl0ZS90cmVlX2ltcGwuaA==) | `91.42% <ø> (+3.78%)` | :arrow_up: | | [include/treelite/detail/serializer\_impl.h](https://app.codecov.io/gh/dmlc/treelite/pull/507?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dmlc#diff-aW5jbHVkZS90cmVlbGl0ZS9kZXRhaWwvc2VyaWFsaXplcl9pbXBsLmg=) | `81.42% <81.42%> (ø)` | | | [src/serializer.cc](https://app.codecov.io/gh/dmlc/treelite/pull/507?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dmlc#diff-c3JjL3NlcmlhbGl6ZXIuY2M=) | `86.46% <86.99%> (-13.54%)` | :arrow_down: | | [include/treelite/detail/serializer\_mixins.h](https://app.codecov.io/gh/dmlc/treelite/pull/507?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dmlc#diff-aW5jbHVkZS90cmVlbGl0ZS9kZXRhaWwvc2VyaWFsaXplcl9taXhpbnMuaA==) | `95.34% <95.34%> (ø)` | | | [include/treelite/tree.h](https://app.codecov.io/gh/dmlc/treelite/pull/507?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dmlc#diff-aW5jbHVkZS90cmVlbGl0ZS90cmVlLmg=) | `90.29% <100.00%> (-1.81%)` | :arrow_down: | ... and [30 files with indirect coverage changes](https://app.codecov.io/gh/dmlc/treelite/pull/507/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dmlc)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

hcho3 commented 1 year ago

@wphicks Can I get a review for this PR?