<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="FeedCreator 1.8" -->
<?xml-stylesheet href="https://www.baszerr.eu/lib/exe/css.php?s=feed" type="text/css"?>
<rss version="2.0">
    <channel xmlns:g="http://base.google.com/ns/1.0">
        <title>BaSzErr - blog:2012:07:28</title>
        <description></description>
        <link>https://www.baszerr.eu/</link>
        <lastBuildDate>Wed, 06 May 2026 09:35:03 +0000</lastBuildDate>
        <generator>FeedCreator 1.8</generator>
        <image>
            <url>https://www.baszerr.eu/lib/exe/fetch.php?media=wiki:dokuwiki.svg</url>
            <title>BaSzErr</title>
            <link>https://www.baszerr.eu/</link>
        </image>
        <item>
            <title>1</title>
            <link>https://www.baszerr.eu/doku.php?id=blog:2012:07:28:1</link>
            <description>
&lt;h1 class=&quot;sectionedit1&quot; id=&quot;small_object_allocation&quot;&gt;2012.07.28 - small object allocation&lt;/h1&gt;
&lt;div class=&quot;level1&quot;&gt;

&lt;p&gt;
&lt;a href=&quot;https://www.baszerr.eu/lib/exe/detail.php?id=blog%3A2012%3A07%3A28%3A1&amp;amp;media=blog:2012:07:28:soa-loki.png&quot; class=&quot;media&quot; title=&quot;blog:2012:07:28:soa-loki.png&quot;&gt;&lt;img src=&quot;https://www.baszerr.eu/lib/exe/fetch.php?w=200&amp;amp;tok=143c00&amp;amp;media=blog:2012:07:28:soa-loki.png&quot; class=&quot;mediaright&quot; align=&quot;right&quot; loading=&quot;lazy&quot; title=&quot;Loki&amp;#039;s SOA code&quot; alt=&quot;Loki&amp;#039;s SOA code&quot; width=&quot;200&quot; /&gt;&lt;/a&gt;
it is often said that default allocator in &lt;a href=&quot;https://en.wikipedia.org/wiki/C++&quot; class=&quot;interwiki iw_wp&quot; title=&quot;https://en.wikipedia.org/wiki/C++&quot;&gt;C++&lt;/a&gt; is not well suited for small objects. by that it is usually meant that it wastes a lot of memory. to solve this &lt;a href=&quot;https://en.wikipedia.org/wiki/Loki (C++)&quot; class=&quot;interwiki iw_wp&quot; title=&quot;https://en.wikipedia.org/wiki/Loki (C++)&quot;&gt;Loki&lt;/a&gt; library provides own memory allocator, specially suited for small objects. i&amp;#039;ve decided to test it.
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;2012.07.28 - small object allocation&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;small_object_allocation&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:0,&amp;quot;secid&amp;quot;:1,&amp;quot;range&amp;quot;:&amp;quot;1-398&amp;quot;} --&gt;
&lt;h2 class=&quot;sectionedit2&quot; id=&quot;test_environment&quot;&gt;test environment&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;
all test have been made with &lt;a href=&quot;https://www.baszerr.eu/lib/exe/fetch.php?media=blog:2012:07:28:test_soa.tar.bz2&quot; class=&quot;media mediafile mf_bz2&quot; title=&quot;blog:2012:07:28:test_soa.tar.bz2 (11.6 KB)&quot;&gt;this code&lt;/a&gt; and its minor modifications. package also includes test results, as measured. in general this programs does 3 things:
&lt;/p&gt;
&lt;ol&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; allocates 1 million elements into the vector.&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; shuffles content&lt;sup&gt;&lt;a href=&quot;#fn__1&quot; id=&quot;fnt__1&quot; class=&quot;fn_top&quot;&gt;1)&lt;/a&gt;&lt;/sup&gt;.&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; deallocates elements one by one, always removing the last one.&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;
my test environment is &lt;a href=&quot;https://en.wikipedia.org/wiki/GNU Compiler Collection&quot; class=&quot;interwiki iw_wp&quot; title=&quot;https://en.wikipedia.org/wiki/GNU Compiler Collection&quot;&gt;GCC&lt;/a&gt; 4.7 run on &lt;a href=&quot;https://en.wikipedia.org/wiki/amd64&quot; class=&quot;interwiki iw_wp&quot; title=&quot;https://en.wikipedia.org/wiki/amd64&quot;&gt;amd64&lt;/a&gt;, &lt;a href=&quot;https://en.wikipedia.org/wiki/Core 2&quot; class=&quot;interwiki iw_wp&quot; title=&quot;https://en.wikipedia.org/wiki/Core 2&quot;&gt;Core 2 Duo&lt;/a&gt; CPU, with 4GB of &lt;a href=&quot;https://en.wikipedia.org/wiki/Random Access Memory&quot; class=&quot;interwiki iw_wp&quot; title=&quot;https://en.wikipedia.org/wiki/Random Access Memory&quot;&gt;RAM&lt;/a&gt;. computer is running &lt;a href=&quot;https://en.wikipedia.org/wiki/Linux&quot; class=&quot;interwiki iw_wp&quot; title=&quot;https://en.wikipedia.org/wiki/Linux&quot;&gt;Linux&lt;/a&gt;. Loki version in use is 0.1.7 (i.e. latest).
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;test environment&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;test_environment&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:0,&amp;quot;secid&amp;quot;:2,&amp;quot;range&amp;quot;:&amp;quot;399-1027&amp;quot;} --&gt;
&lt;h2 class=&quot;sectionedit3&quot; id=&quot;execution_time&quot;&gt;execution time&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;
first thing i&amp;#039;ve measured is execution time. &lt;em&gt;N&lt;/em&gt; is size of the structure used for allocation (i.e. small object to be tested). &lt;em&gt;SYSTEM_ALLOC&lt;/em&gt; means that default, system &lt;em&gt;new&lt;/em&gt; and &lt;em&gt;delete&lt;/em&gt; operators were used. &lt;em&gt;USE_LOKI_SOA&lt;/em&gt; means that Loki&amp;#039;s small object allocator (SOA) was used. all times are measured in seconds. each step of the algorithm has been measured separately.
&lt;/p&gt;

&lt;p&gt;
here are the results for full test, that shuffles data before deallocation:
&lt;/p&gt;
&lt;div class=&quot;table sectionedit4&quot;&gt;&lt;table class=&quot;inline&quot;&gt;
	&lt;thead&gt;
	&lt;tr class=&quot;row0&quot;&gt;
		&lt;th class=&quot;col0&quot;&gt; mode &lt;/th&gt;&lt;th class=&quot;col1&quot;&gt; allocation &lt;/th&gt;&lt;th class=&quot;col2&quot;&gt; shuffing &lt;/th&gt;&lt;th class=&quot;col3&quot;&gt; deallocation &lt;/th&gt;
	&lt;/tr&gt;
	&lt;/thead&gt;
	&lt;tr class=&quot;row1&quot;&gt;
		&lt;td class=&quot;col0&quot;&gt; N=1, SYSTEM_ALLOC &lt;/td&gt;&lt;td class=&quot;col1&quot;&gt; 0.081 &lt;/td&gt;&lt;td class=&quot;col2&quot;&gt; 0.103 &lt;/td&gt;&lt;td class=&quot;col3&quot;&gt; 0.148 &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row2&quot;&gt;
		&lt;td class=&quot;col0&quot;&gt; N=10, SYSTEM_ALLOC &lt;/td&gt;&lt;td class=&quot;col1&quot;&gt; 0.078 &lt;/td&gt;&lt;td class=&quot;col2&quot;&gt; 0.107 &lt;/td&gt;&lt;td class=&quot;col3&quot;&gt; 0.141 &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row3&quot;&gt;
		&lt;td class=&quot;col0&quot;&gt; N=20, SYSTEM_ALLOC &lt;/td&gt;&lt;td class=&quot;col1&quot;&gt; 0.077 &lt;/td&gt;&lt;td class=&quot;col2&quot;&gt; 0.108 &lt;/td&gt;&lt;td class=&quot;col3&quot;&gt; 0.143 &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row4&quot;&gt;
		&lt;td class=&quot;col0&quot;&gt; N=30, SYSTEM_ALLOC &lt;/td&gt;&lt;td class=&quot;col1&quot;&gt; 0.092 &lt;/td&gt;&lt;td class=&quot;col2&quot;&gt; 0.107 &lt;/td&gt;&lt;td class=&quot;col3&quot;&gt; 0.150 &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row5&quot;&gt;
		&lt;td class=&quot;col0&quot;&gt; N=40, SYSTEM_ALLOC &lt;/td&gt;&lt;td class=&quot;col1&quot;&gt; 0.091 &lt;/td&gt;&lt;td class=&quot;col2&quot;&gt; 0.107 &lt;/td&gt;&lt;td class=&quot;col3&quot;&gt; 0.150 &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row6&quot;&gt;
		&lt;td class=&quot;col0&quot;&gt; N=50, SYSTEM_ALLOC &lt;/td&gt;&lt;td class=&quot;col1&quot;&gt; 0.102 &lt;/td&gt;&lt;td class=&quot;col2&quot;&gt; 0.104 &lt;/td&gt;&lt;td class=&quot;col3&quot;&gt; 0.149 &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row7&quot;&gt;
		&lt;td class=&quot;col0&quot;&gt; N=1, USE_LOKI_SOA &lt;/td&gt;&lt;td class=&quot;col1&quot;&gt; 0.056 &lt;/td&gt;&lt;td class=&quot;col2&quot;&gt; 0.111 &lt;/td&gt;&lt;td class=&quot;col3&quot;&gt; 4.372 &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row8&quot;&gt;
		&lt;td class=&quot;col0&quot;&gt; N=10, USE_LOKI_SOA &lt;/td&gt;&lt;td class=&quot;col1&quot;&gt; 0.063 &lt;/td&gt;&lt;td class=&quot;col2&quot;&gt; 0.110 &lt;/td&gt;&lt;td class=&quot;col3&quot;&gt; 4.345 &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row9&quot;&gt;
		&lt;td class=&quot;col0&quot;&gt; N=20, USE_LOKI_SOA &lt;/td&gt;&lt;td class=&quot;col1&quot;&gt; 0.076 &lt;/td&gt;&lt;td class=&quot;col2&quot;&gt; 0.100 &lt;/td&gt;&lt;td class=&quot;col3&quot;&gt; 5.383 &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row10&quot;&gt;
		&lt;td class=&quot;col0&quot;&gt; N=30, USE_LOKI_SOA &lt;/td&gt;&lt;td class=&quot;col1&quot;&gt; 0.110 &lt;/td&gt;&lt;td class=&quot;col2&quot;&gt; 0.099 &lt;/td&gt;&lt;td class=&quot;col3&quot;&gt; 8.543 &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row11&quot;&gt;
		&lt;td class=&quot;col0&quot;&gt; N=40, USE_LOKI_SOA &lt;/td&gt;&lt;td class=&quot;col1&quot;&gt; 0.140 &lt;/td&gt;&lt;td class=&quot;col2&quot;&gt; 0.108 &lt;/td&gt;&lt;td class=&quot;col3&quot;&gt; 10.647 &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row12&quot;&gt;
		&lt;td class=&quot;col0&quot;&gt; N=50, USE_LOKI_SOA &lt;/td&gt;&lt;td class=&quot;col1&quot;&gt; 0.188 &lt;/td&gt;&lt;td class=&quot;col2&quot;&gt; 0.098 &lt;/td&gt;&lt;td class=&quot;col3&quot;&gt; 13.875 &lt;/td&gt;
	&lt;/tr&gt;
&lt;/table&gt;&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;table&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;table&amp;quot;,&amp;quot;secid&amp;quot;:4,&amp;quot;range&amp;quot;:&amp;quot;1518-2140&amp;quot;} --&gt;
&lt;p&gt;
it appears that Loki&amp;#039;s allocator is faster for VERY small objects, up to about 20 bytes. deallocation, on the other hand, is 40 times slower than when using default one.
&lt;/p&gt;

&lt;p&gt;
one more common scenario is allocation and deallocation that is done in order. this can be simulated by turning off shuffling step. results of measurements are presented in the table:
&lt;/p&gt;
&lt;div class=&quot;table sectionedit5&quot;&gt;&lt;table class=&quot;inline&quot;&gt;
	&lt;thead&gt;
	&lt;tr class=&quot;row0&quot;&gt;
		&lt;th class=&quot;col0&quot;&gt; mode &lt;/th&gt;&lt;th class=&quot;col1&quot;&gt; allocation &lt;/th&gt;&lt;th class=&quot;col2&quot;&gt; shuffing &lt;/th&gt;&lt;th class=&quot;col3&quot;&gt; deallocation &lt;/th&gt;
	&lt;/tr&gt;
	&lt;/thead&gt;
	&lt;tr class=&quot;row1&quot;&gt;
		&lt;td class=&quot;col0&quot;&gt; N=1, SYSTEM_ALLOC &lt;/td&gt;&lt;td class=&quot;col1&quot;&gt; 0.078 &lt;/td&gt;&lt;td class=&quot;col2&quot;&gt; 0.000 &lt;/td&gt;&lt;td class=&quot;col3&quot;&gt; 0.029 &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row2&quot;&gt;
		&lt;td class=&quot;col0&quot;&gt; N=10, SYSTEM_ALLOC &lt;/td&gt;&lt;td class=&quot;col1&quot;&gt; 0.078 &lt;/td&gt;&lt;td class=&quot;col2&quot;&gt; 0.000 &lt;/td&gt;&lt;td class=&quot;col3&quot;&gt; 0.032 &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row3&quot;&gt;
		&lt;td class=&quot;col0&quot;&gt; N=20, SYSTEM_ALLOC &lt;/td&gt;&lt;td class=&quot;col1&quot;&gt; 0.082 &lt;/td&gt;&lt;td class=&quot;col2&quot;&gt; 0.000 &lt;/td&gt;&lt;td class=&quot;col3&quot;&gt; 0.030 &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row4&quot;&gt;
		&lt;td class=&quot;col0&quot;&gt; N=30, SYSTEM_ALLOC &lt;/td&gt;&lt;td class=&quot;col1&quot;&gt; 0.090 &lt;/td&gt;&lt;td class=&quot;col2&quot;&gt; 0.000 &lt;/td&gt;&lt;td class=&quot;col3&quot;&gt; 0.033 &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row5&quot;&gt;
		&lt;td class=&quot;col0&quot;&gt; N=40, SYSTEM_ALLOC &lt;/td&gt;&lt;td class=&quot;col1&quot;&gt; 0.091 &lt;/td&gt;&lt;td class=&quot;col2&quot;&gt; 0.000 &lt;/td&gt;&lt;td class=&quot;col3&quot;&gt; 0.035 &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row6&quot;&gt;
		&lt;td class=&quot;col0&quot;&gt; N=50, SYSTEM_ALLOC &lt;/td&gt;&lt;td class=&quot;col1&quot;&gt; 0.102 &lt;/td&gt;&lt;td class=&quot;col2&quot;&gt; 0.000 &lt;/td&gt;&lt;td class=&quot;col3&quot;&gt; 0.040 &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row7&quot;&gt;
		&lt;td class=&quot;col0&quot;&gt; N=1, USE_LOKI_SOA &lt;/td&gt;&lt;td class=&quot;col1&quot;&gt; 0.057 &lt;/td&gt;&lt;td class=&quot;col2&quot;&gt; 0.000 &lt;/td&gt;&lt;td class=&quot;col3&quot;&gt; 0.050 &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row8&quot;&gt;
		&lt;td class=&quot;col0&quot;&gt; N=10, USE_LOKI_SOA &lt;/td&gt;&lt;td class=&quot;col1&quot;&gt; 0.063 &lt;/td&gt;&lt;td class=&quot;col2&quot;&gt; 0.000 &lt;/td&gt;&lt;td class=&quot;col3&quot;&gt; 0.052 &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row9&quot;&gt;
		&lt;td class=&quot;col0&quot;&gt; N=20, USE_LOKI_SOA &lt;/td&gt;&lt;td class=&quot;col1&quot;&gt; 0.075 &lt;/td&gt;&lt;td class=&quot;col2&quot;&gt; 0.000 &lt;/td&gt;&lt;td class=&quot;col3&quot;&gt; 0.061 &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row10&quot;&gt;
		&lt;td class=&quot;col0&quot;&gt; N=30, USE_LOKI_SOA &lt;/td&gt;&lt;td class=&quot;col1&quot;&gt; 0.108 &lt;/td&gt;&lt;td class=&quot;col2&quot;&gt; 0.000 &lt;/td&gt;&lt;td class=&quot;col3&quot;&gt; 0.066 &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row11&quot;&gt;
		&lt;td class=&quot;col0&quot;&gt; N=40, USE_LOKI_SOA &lt;/td&gt;&lt;td class=&quot;col1&quot;&gt; 0.137 &lt;/td&gt;&lt;td class=&quot;col2&quot;&gt; 0.000 &lt;/td&gt;&lt;td class=&quot;col3&quot;&gt; 0.056 &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row12&quot;&gt;
		&lt;td class=&quot;col0&quot;&gt; N=50, USE_LOKI_SOA &lt;/td&gt;&lt;td class=&quot;col1&quot;&gt; 0.190 &lt;/td&gt;&lt;td class=&quot;col2&quot;&gt; 0.000 &lt;/td&gt;&lt;td class=&quot;col3&quot;&gt; 0.058 &lt;/td&gt;
	&lt;/tr&gt;
&lt;/table&gt;&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;table&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;table1&amp;quot;,&amp;quot;secid&amp;quot;:5,&amp;quot;range&amp;quot;:&amp;quot;2498-3118&amp;quot;} --&gt;
&lt;p&gt;
one can see, that shuffling time is 0 (not being run). as in the previous test case, allocation is faster with Loki for &lt;em&gt;N&lt;/em&gt; less than 20 bytes. deallocation is still significantly slower, but at least is in the same row of magnitude as the system allocator.
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;execution time&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;execution_time&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:0,&amp;quot;secid&amp;quot;:3,&amp;quot;range&amp;quot;:&amp;quot;1028-3381&amp;quot;} --&gt;
&lt;h2 class=&quot;sectionedit6&quot; id=&quot;memory&quot;&gt;memory&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;
the main thing about the Loki&amp;#039;s SOA is minimizing memory footprint. therefor memory used by the process has been measured with /proc/&amp;lt;pid&amp;gt;/status file. notice that it is needed to be measured on system-level, since sum of each allocation requests will be the same for both versions. results follows (values are in kB):
&lt;/p&gt;
&lt;div class=&quot;table sectionedit7&quot;&gt;&lt;table class=&quot;inline&quot;&gt;
	&lt;thead&gt;
	&lt;tr class=&quot;row0&quot;&gt;
		&lt;th class=&quot;col0&quot;&gt; N &lt;/th&gt;&lt;th class=&quot;col1&quot;&gt; sys. alloc &lt;/th&gt;&lt;th class=&quot;col2&quot;&gt; Loki &lt;/th&gt;
	&lt;/tr&gt;
	&lt;/thead&gt;
	&lt;tr class=&quot;row1&quot;&gt;
		&lt;td class=&quot;col0&quot;&gt; 1 &lt;/td&gt;&lt;td class=&quot;col1&quot;&gt; 57196 &lt;/td&gt;&lt;td class=&quot;col2&quot;&gt; 30012 &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row2&quot;&gt;
		&lt;td class=&quot;col0&quot;&gt; 20 &lt;/td&gt;&lt;td class=&quot;col1&quot;&gt; 57196 &lt;/td&gt;&lt;td class=&quot;col2&quot;&gt; 45720 &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row3&quot;&gt;
		&lt;td class=&quot;col0&quot;&gt; 40 &lt;/td&gt;&lt;td class=&quot;col1&quot;&gt; 72904 &lt;/td&gt;&lt;td class=&quot;col2&quot;&gt; 65516 &lt;/td&gt;
	&lt;/tr&gt;
&lt;/table&gt;&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;table&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;table2&amp;quot;,&amp;quot;secid&amp;quot;:7,&amp;quot;range&amp;quot;:&amp;quot;3722-3815&amp;quot;} --&gt;
&lt;p&gt;
a great improvement in memory footprint is visible for very small objects, when Loki&amp;#039;s SOA is used. in case of 1-byte objects it is almost 2x less memory in use. for 20 bytes it is still 20% less.
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;memory&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;memory&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:0,&amp;quot;secid&amp;quot;:6,&amp;quot;range&amp;quot;:&amp;quot;3382-4015&amp;quot;} --&gt;
&lt;h2 class=&quot;sectionedit8&quot; id=&quot;conclusions&quot;&gt;conclusions&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;
first observation is that my implementation&amp;#039;s/system&amp;#039;s default allocator is doing well, when it comes to speed of (de)allocations. it is much worse, when talking about memory usage, for very small objects, but still it is not that bad, as one could expect.
&lt;/p&gt;

&lt;p&gt;
it appears that it is indeed beneficial to use Loki&amp;#039;s SOA, in case where many small (on my test environment this means less then 20 bytes) objects are to be allocated. it is also worth noticing that Loki&amp;#039;s SOA is slower when deallocating in random order, thus memory restrictions must be of a greater concern than execution time, to make this solution beneficial.
&lt;/p&gt;

&lt;p&gt;
after all, it is not a secret, that when it comes to the memory allocation, “one size fits all” does not apply. choose the right tool for your needs and base your reasoning on measurements.
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;conclusions&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;conclusions&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:0,&amp;quot;secid&amp;quot;:8,&amp;quot;range&amp;quot;:&amp;quot;4016-&amp;quot;} --&gt;&lt;div class=&quot;footnotes&quot;&gt;
&lt;div class=&quot;fn&quot;&gt;&lt;sup&gt;&lt;a href=&quot;#fnt__1&quot; id=&quot;fn__1&quot; class=&quot;fn_bot&quot;&gt;1)&lt;/a&gt;&lt;/sup&gt; 
&lt;div class=&quot;content&quot;&gt;this step is optional.&lt;/div&gt;&lt;/div&gt;
&lt;/div&gt;
</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Tue, 15 Jun 2021 20:09:13 +0000</pubDate>
        </item>
    </channel>
</rss>
