amend benchmarks

This commit is contained in:
Rawley
2024-02-20 11:45:53 -06:00
parent c29b3f0a64
commit 6e6e3afdc9

View File

@@ -95,6 +95,10 @@ for ( 1 .. 1000000 ) {
11420.455ms
</td>
</tr>
<tr>
<td>Moose + Immutable</td>
<td>1182.109ms</td>
</tr>
<tr>
<td>
Moose + Types
@@ -438,11 +442,23 @@ for ( 1 .. 1000000 ) {
<p>
Just like <code>Moo</code> with types, <code>Type::Tiny</code> hits the final <code>Moose</code> result by around 2000ms overall.
</p>
<p>
<b>Amendment</b>: After publishing my original findings I was alerted to a <a href="https://github.com/rawleyfowler/perl-oo-action-benchmark/pull/1">setting you could apply to Moose classes</a> that make them immutable.
Immutable often means faster in-terms of creation but slower in terms of manipulation, but since this workload spends most of its time creating, and none of its time editing,
this produced an incredible 10x speed improvement.
</p>
<h5>Immutable trick for Moose</h5>
<pre>
<code>
__PACKAGE__->meta->make_immutable;
</code>
</pre>
<h5>Time:</h5>
<pre>
<code>
MOOSE TIME : 11420.455ms
MOOSE + TYPES TIME : 13649.37ms
MOOSE IMMU TIME : 1182.109ms
</code>
</pre>
<h3 id="rubyImpl">Ruby</h3>