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

performance optimizations #171

Merged
merged 2 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
142 changes: 39 additions & 103 deletions BENCHMARK.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Benchmark

Benchmark run from 2023-11-23 17:53:11.749718Z UTC
Benchmark run from 2023-11-23 21:52:00.638488Z UTC

## System

Expand Down Expand Up @@ -65,20 +65,20 @@ Run Time

<tr>
<td style="white-space: nowrap">Jason</td>
<td style="white-space: nowrap; text-align: right">248.88</td>
<td style="white-space: nowrap; text-align: right">4.02 ms</td>
<td style="white-space: nowrap; text-align: right">&plusmn;14.75%</td>
<td style="white-space: nowrap; text-align: right">3.81 ms</td>
<td style="white-space: nowrap; text-align: right">5.72 ms</td>
<td style="white-space: nowrap; text-align: right">271.78</td>
<td style="white-space: nowrap; text-align: right">3.68 ms</td>
<td style="white-space: nowrap; text-align: right">&plusmn;14.00%</td>
<td style="white-space: nowrap; text-align: right">3.44 ms</td>
<td style="white-space: nowrap; text-align: right">4.95 ms</td>
</tr>

<tr>
<td style="white-space: nowrap">Ymlr</td>
<td style="white-space: nowrap; text-align: right">3.27</td>
<td style="white-space: nowrap; text-align: right">305.72 ms</td>
<td style="white-space: nowrap; text-align: right">&plusmn;1.14%</td>
<td style="white-space: nowrap; text-align: right">305.02 ms</td>
<td style="white-space: nowrap; text-align: right">317.72 ms</td>
<td style="white-space: nowrap; text-align: right">70.89</td>
<td style="white-space: nowrap; text-align: right">14.11 ms</td>
<td style="white-space: nowrap; text-align: right">&plusmn;3.32%</td>
<td style="white-space: nowrap; text-align: right">14.06 ms</td>
<td style="white-space: nowrap; text-align: right">15.51 ms</td>
</tr>

</table>
Expand All @@ -93,41 +93,20 @@ Run Time Comparison
<th style="text-align: right">Slower</th>
<tr>
<td style="white-space: nowrap">Jason</td>
<td style="white-space: nowrap;text-align: right">248.88</td>
<td style="white-space: nowrap;text-align: right">271.78</td>
<td>&nbsp;</td>
</tr>

<tr>
<td style="white-space: nowrap">Ymlr</td>
<td style="white-space: nowrap; text-align: right">3.27</td>
<td style="white-space: nowrap; text-align: right">76.09x</td>
<td style="white-space: nowrap; text-align: right">70.89</td>
<td style="white-space: nowrap; text-align: right">3.83x</td>
</tr>

</table>



Memory Usage

<table style="width: 1%">
<tr>
<th>Name</th>
<th style="text-align: right">Average</th>
<th style="text-align: right">Factor</th>
</tr>
<tr>
<td style="white-space: nowrap">Jason</td>
<td style="white-space: nowrap">4.80 MB</td>
<td>&nbsp;</td>
</tr>
<tr>
<td style="white-space: nowrap">Ymlr</td>
<td style="white-space: nowrap">68.18 MB</td>
<td>14.19x</td>
</tr>
</table>



__Input: Canada__

Expand All @@ -145,20 +124,20 @@ Run Time

<tr>
<td style="white-space: nowrap">Jason</td>
<td style="white-space: nowrap; text-align: right">121.34</td>
<td style="white-space: nowrap; text-align: right">8.24 ms</td>
<td style="white-space: nowrap; text-align: right">&plusmn;142.36%</td>
<td style="white-space: nowrap; text-align: right">7.35 ms</td>
<td style="white-space: nowrap; text-align: right">124.25</td>
<td style="white-space: nowrap; text-align: right">8.05 ms</td>
<td style="white-space: nowrap; text-align: right">&plusmn;14.06%</td>
<td style="white-space: nowrap; text-align: right">7.67 ms</td>
<td style="white-space: nowrap; text-align: right">13.61 ms</td>
</tr>

<tr>
<td style="white-space: nowrap">Ymlr</td>
<td style="white-space: nowrap; text-align: right">21.10</td>
<td style="white-space: nowrap; text-align: right">47.39 ms</td>
<td style="white-space: nowrap; text-align: right">&plusmn;62.18%</td>
<td style="white-space: nowrap; text-align: right">43.84 ms</td>
<td style="white-space: nowrap; text-align: right">319.16 ms</td>
<td style="white-space: nowrap; text-align: right">30.69</td>
<td style="white-space: nowrap; text-align: right">32.58 ms</td>
<td style="white-space: nowrap; text-align: right">&plusmn;8.57%</td>
<td style="white-space: nowrap; text-align: right">33.61 ms</td>
<td style="white-space: nowrap; text-align: right">36.95 ms</td>
</tr>

</table>
Expand All @@ -173,41 +152,20 @@ Run Time Comparison
<th style="text-align: right">Slower</th>
<tr>
<td style="white-space: nowrap">Jason</td>
<td style="white-space: nowrap;text-align: right">121.34</td>
<td style="white-space: nowrap;text-align: right">124.25</td>
<td>&nbsp;</td>
</tr>

<tr>
<td style="white-space: nowrap">Ymlr</td>
<td style="white-space: nowrap; text-align: right">21.10</td>
<td style="white-space: nowrap; text-align: right">5.75x</td>
<td style="white-space: nowrap; text-align: right">30.69</td>
<td style="white-space: nowrap; text-align: right">4.05x</td>
</tr>

</table>



Memory Usage

<table style="width: 1%">
<tr>
<th>Name</th>
<th style="text-align: right">Average</th>
<th style="text-align: right">Factor</th>
</tr>
<tr>
<td style="white-space: nowrap">Jason</td>
<td style="white-space: nowrap">9.22 MB</td>
<td>&nbsp;</td>
</tr>
<tr>
<td style="white-space: nowrap">Ymlr</td>
<td style="white-space: nowrap">50.09 MB</td>
<td>5.43x</td>
</tr>
</table>



__Input: Twitter__

Expand All @@ -225,20 +183,20 @@ Run Time

<tr>
<td style="white-space: nowrap">Jason</td>
<td style="white-space: nowrap; text-align: right">368.32</td>
<td style="white-space: nowrap; text-align: right">2.72 ms</td>
<td style="white-space: nowrap; text-align: right">&plusmn;251.44%</td>
<td style="white-space: nowrap; text-align: right">2.57 ms</td>
<td style="white-space: nowrap; text-align: right">3.29 ms</td>
<td style="white-space: nowrap; text-align: right">372.32</td>
<td style="white-space: nowrap; text-align: right">2.69 ms</td>
<td style="white-space: nowrap; text-align: right">&plusmn;4.89%</td>
<td style="white-space: nowrap; text-align: right">2.67 ms</td>
<td style="white-space: nowrap; text-align: right">3.22 ms</td>
</tr>

<tr>
<td style="white-space: nowrap">Ymlr</td>
<td style="white-space: nowrap; text-align: right">4.76</td>
<td style="white-space: nowrap; text-align: right">210.14 ms</td>
<td style="white-space: nowrap; text-align: right">&plusmn;0.45%</td>
<td style="white-space: nowrap; text-align: right">209.83 ms</td>
<td style="white-space: nowrap; text-align: right">211.96 ms</td>
<td style="white-space: nowrap; text-align: right">123.21</td>
<td style="white-space: nowrap; text-align: right">8.12 ms</td>
<td style="white-space: nowrap; text-align: right">&plusmn;1.95%</td>
<td style="white-space: nowrap; text-align: right">8.11 ms</td>
<td style="white-space: nowrap; text-align: right">8.59 ms</td>
</tr>

</table>
Expand All @@ -253,36 +211,14 @@ Run Time Comparison
<th style="text-align: right">Slower</th>
<tr>
<td style="white-space: nowrap">Jason</td>
<td style="white-space: nowrap;text-align: right">368.32</td>
<td style="white-space: nowrap;text-align: right">372.32</td>
<td>&nbsp;</td>
</tr>

<tr>
<td style="white-space: nowrap">Ymlr</td>
<td style="white-space: nowrap; text-align: right">4.76</td>
<td style="white-space: nowrap; text-align: right">77.4x</td>
<td style="white-space: nowrap; text-align: right">123.21</td>
<td style="white-space: nowrap; text-align: right">3.02x</td>
</tr>

</table>



Memory Usage

<table style="width: 1%">
<tr>
<th>Name</th>
<th style="text-align: right">Average</th>
<th style="text-align: right">Factor</th>
</tr>
<tr>
<td style="white-space: nowrap">Jason</td>
<td style="white-space: nowrap">2.54 MB</td>
<td>&nbsp;</td>
</tr>
<tr>
<td style="white-space: nowrap">Ymlr</td>
<td style="white-space: nowrap">65.86 MB</td>
<td>25.89x</td>
</tr>
</table>
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Added

- Support for escape and unicode characters [#98](https://github.com/ufirstgroup/ymlr/pull/98)
- Refactor `Ymlr.Encode` to make it faster.

<!--------------------- Don't add new entries after this line --------------------->

Expand Down
1 change: 0 additions & 1 deletion benchmark/run.exs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ Benchee.run(
"Jason" => fn input -> Jason.encode!(input) end,
"Ymlr" => fn input -> Ymlr.document!(input) end
},
memory_time: 60,
inputs: inputs,
formatters: [
{Benchee.Formatters.Markdown, file: "../BENCHMARK.md"},
Expand Down
Loading
Loading