partiql / partiql-lang-kotlin

PartiQL libraries and tools in Kotlin.
https://partiql.org/
Apache License 2.0
538 stars 60 forks source link

Reduce stack usage of the pretty-printer #1402

Closed RCHowell closed 6 months ago

RCHowell commented 6 months ago

Relevant Issues

1400

TODO bench marking and versioning discussion. I'm porting these changes to Scribe now.

Description

This improves the pretty-printer performance (mem and stacksize) by using a linked-list rather than (similarly) creating a tree of links via link nodes. This is a more minimal implementation which uses fewer objects and stack frames. It also uses tail recursion when building the output string which mitigates stack size issues in that part.

Other Information

License Information

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

github-actions[bot] commented 6 months ago

Conformance comparison report

Base (6da7496d775fa2167228c3a97bfbbd725ddf8ba4) c8fa109d5d8fa18b30e8b69c7daa86abb89522d9 +/-
% Passing 92.54% 92.54% 0.00%
:white_check_mark: Passing 5384 5384 0
:x: Failing 434 434 0
:large_orange_diamond: Ignored 0 0 0
Total Tests 5818 5818 0

Number passing in both: 5384

Number failing in both: 434

Number passing in Base (6da7496d775fa2167228c3a97bfbbd725ddf8ba4) but now fail: 0

Number failing in Base (6da7496d775fa2167228c3a97bfbbd725ddf8ba4) but now pass: 0

codecov-commenter commented 6 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 73.14%. Comparing base (5bcde13) to head (440ec01). Report is 1 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1402 +/- ## ========================================= Coverage 73.14% 73.14% Complexity 2393 2393 ========================================= Files 247 247 Lines 17623 17623 Branches 3176 3176 ========================================= Hits 12890 12890 Misses 3856 3856 Partials 877 877 ``` | [Flag](https://app.codecov.io/gh/partiql/partiql-lang-kotlin/pull/1402/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=partiql) | Coverage Δ | | |---|---|---| | [CLI](https://app.codecov.io/gh/partiql/partiql-lang-kotlin/pull/1402/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=partiql) | `11.82% <ø> (ø)` | | | [EXAMPLES](https://app.codecov.io/gh/partiql/partiql-lang-kotlin/pull/1402/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=partiql) | `80.07% <ø> (ø)` | | | [LANG](https://app.codecov.io/gh/partiql/partiql-lang-kotlin/pull/1402/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=partiql) | `81.04% <ø> (ø)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=partiql#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.