<p>I'll call this fixed. Through a bunch of optimisations (there were a lot more causes of slowness than I expected), I managed speed-ups of up to x35, (and that's not even including my rewrite of the palette cache, which gives another ~30% boost to spriteset browsing, but I'll leave that until after Fufluns).</p>
<p>A summary of the improvements: times to enter a menu for the first time (in milliseconds on an AMD FX-6100 3.3GHz which is a 2011-era CPU):</p>
<pre><code>Vikings
|           | Enemies    | Attacks    |
|           |  Old | New |  Old | New |
| WindowsXP | 2230 |  63 | 1194 |  92 |
| Linux     |  314 |  24 |  114 |  29 |

The Adventures of Powerstick Man
|           | Textboxes  | Walkabouts  |
|           |  Old | New |   Old | New |
| WindowsXP | 3343 | 815 | 17217 | 591 |
| Linux     |  678 | 326 |  3595 | 163 |
</code></pre>
<p>0.8 seconds to enter the textboxes menu is still a bit unpleasant, though.</p>
<p><code>lazyclose</code> is mostly to thank for narrowing the gap between Windows and Linux. Here's detailed breakdown of timings (milliseconds) for entering the Textbox thingbrowser in Vikings, showing <code>close</code> vs <code>lazyclose</code></p>
<pre><code>|              |           | OPENFILE | Close | loadrecord |    Fill | Create | Total |
|              |           |          |  file |            | TextBox | planks |       |
|              |           |          |       |            |         |        |       |
|--------------+-----------+----------+-------+------------+---------+--------+-------|
|              | CLOSE     |      352 |   228 |        248 |      50 |     94 |  1058 |
| WindowsXP    | LAZYCLOSE |       47 |    40 |        140 |      48 |    106 |   429 |
|--------------+-----------+----------+-------+------------+---------+--------+-------|
| WindowsXP    | CLOSE     |      283 |   186 |        244 |      54 |     90 |   928 |
| nomutex      | LAZYCLOSE |       17 |    18 |        135 |      46 |    104 |   359 |
|--------------+-----------+----------+-------+------------+---------+--------+-------|
|              | CLOSE     |      257 |    80 |        130 |      46 |     85 |   628 |
| Windows10    | LAZYCLOSE |       20 |    16 |        107 |      45 |     81 |   299 |
|--------------+-----------+----------+-------+------------+---------+--------+-------|
|              | CLOSE     |       30 |     6 |         28 |      27 |     54 |   148 |
| Linux        | LAZYCLOSE |        5 |   0.4 |         29 |      27 |     54 |   116 |
</code></pre>
<p>Key:</p>
<ul>
<li>Close file: CLOSE or lazyclose</li>
<li>loadrecord: excluding open and close time - just seeking/reading (NOTE: these timings were taken before I optimised loadrecord</li>
<li>Fill Textbox: LoadTextbox except time spent in loadrecord (including the open and close)</li>
<li>Create planks: build_thing_list except time spent in LoadTextBox</li>
<li>Windows10 is 19.10.</li>
<li>"WindowsXP nomutex" is with mutexes in filelayer.cpp commented out (they are completely unnecessary at the moment, since we don't do file I/O on multiple threads).</li>
</ul>
<p>Note: The timing adds a lot of overhead, and I didn't try to fix the CPU frequency. That's why you see switching from <code>close</code> to <code>lazyclose</code> affecting things it shouldn't.</p>
<p>Note: Comparisons across OSes aren't fair: all are on AMD FX-6100 CPUs, but Win10 is running on a CPU clocked a little slower, Windows XP is running under Virtualbox (which slows down syscalls particularly), Linux times are while running under gdb. Also I used GCC 9.1 on Linux and GCC 4.5 on Windows, which I think is to blame for the 'Fill TextBox'/'Create planks' OS differences.</p>
<p>Not to mention the improvements to the map browser, which was another part of this bug.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/ohrrpgce/ohrrpgce/issues/1?email_source=notifications&email_token=AMWGWZTGJFGAX5YUKEVMAWLQ3SVUJA5CNFSM4H7GPAR2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEH5GWYI#issuecomment-570059617">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AMWGWZQ5OIM4VHOHZJNB2JTQ3SVUJANCNFSM4H7GPARQ">unsubscribe</a>.<img src="https://github.com/notifications/beacon/AMWGWZURE74YHYY54Q7XZFLQ3SVUJA5CNFSM4H7GPAR2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEH5GWYI.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/ohrrpgce/ohrrpgce/issues/1?email_source=notifications\u0026email_token=AMWGWZTGJFGAX5YUKEVMAWLQ3SVUJA5CNFSM4H7GPAR2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEH5GWYI#issuecomment-570059617",
"url": "https://github.com/ohrrpgce/ohrrpgce/issues/1?email_source=notifications\u0026email_token=AMWGWZTGJFGAX5YUKEVMAWLQ3SVUJA5CNFSM4H7GPAR2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEH5GWYI#issuecomment-570059617",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>