<p dir="auto"><strong>Describe the bug</strong></p>
<p dir="auto">A specific test file (for color space testing) is causing threejs to become unresponsive and take the entire browser with it.</p>
<p dir="auto"><strong>To Reproduce</strong></p>
<p dir="auto">Steps to reproduce the behavior:</p>
<ol dir="auto">
<li>download the attached file<br>
<a href="https://github.com/mrdoob/three.js/files/7478938/unlit.color.zip">unlit=color.zip</a></li>
<li>open the file in <a href="https://threejs.org/editor/" rel="nofollow">https://threejs.org/editor/</a></li>
<li>zoom out until you can see the content</li>
<li>note browser is hanging, changing tabs doesn't change that, have to kill browser</li>
</ol>
<p dir="auto"><strong>Expected behavior</strong></p>
<p dir="auto">File loads and displays fast, it's pretty small.</p>
<p dir="auto"><strong>Screenshots</strong><br>
The file is a test case for textures/colors/vertex colors. It has many small meshes and materials but loads very fast in other systems (e.g. Babylon Sandbox or gltf.report)<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/2693840/140424265-d1a5fda4-43ea-4a37-ac00-32bf45d95e0b.png"><img src="https://user-images.githubusercontent.com/2693840/140424265-d1a5fda4-43ea-4a37-ac00-32bf45d95e0b.png" alt="image" style="max-width: 100%;"></a></p>
<p dir="auto"><strong>Platform:</strong></p>
<ul dir="auto">
<li>Device: Desktop</li>
<li>OS: Windows 10</li>
<li>Browser: Chrome 95.0.4638.69</li>
</ul>
<p dir="auto"><strong>Describe the bug</strong></p>
<p dir="auto">This appears to be the core issue behind <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1034512293" data-permission-text="Title is private" data-url="https://github.com/google/model-viewer/issues/2915" data-hovercard-type="issue" data-hovercard-url="/google/model-viewer/issues/2915/hovercard" href="https://github.com/google/model-viewer/issues/2915">google/model-viewer#2915</a></p>
<p dir="auto">It seems that something about a recent materials change has caused shader compilation on my PC to take ~10x(!) longer than it used to. If I were to guess at why I'd say that it's probably the DirectX shader compiler hitting a pathological case that wasn't there before and trying to do an insane loop unroll or something of that nature.</p>
<p dir="auto"><strong>To Reproduce</strong></p>
<p dir="auto">Steps to reproduce the behavior:</p>
<ol dir="auto">
<li>git checkout r132</li>
<li>Open examples/webgl_animation_keyframes.html</li>
<li>Observe load time</li>
<li>git checkout r133</li>
<li>Refresh examples/webgl_animation_keyframes.html</li>
<li>Observe (much longer) load time</li>
</ol>
<p dir="auto">With r132 I get the following recording from the performance tab in Chrome dev tools (though it's worth noting the same regression is also observable when using Firefox):</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/805273/139484874-de26dba4-16ab-4794-bd41-9c9b328d0201.png"><img width="884" alt="Screenshot 2021-10-29 113147" src="https://user-images.githubusercontent.com/805273/139484874-de26dba4-16ab-4794-bd41-9c9b328d0201.png" style="max-width: 100%;"></a></p>
<p dir="auto">You can see that the largest block of work on the main thread takes ~500ms. It bottoms out at a bunch of getProgramInfoLog calls and a couple of texImage2D calls that all take about 20-50ms.</p>
<p dir="auto">With r133 the recording looks significantly different. There are multiple calls to getProgramInfoLog that take ~150ms each and one particularly long one that takes 3+ seconds! In total, the block of work that represents to model's upload to the GPU takes nearly 5 seconds to complete, a 10x increase between versions (and consistent with what  was seeing.)</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/805273/139485848-3c228c54-2038-4cc2-bf63-b5834814e413.png"><img width="884" alt="Screenshot 2021-10-29 113654" src="https://user-images.githubusercontent.com/805273/139485848-3c228c54-2038-4cc2-bf63-b5834814e413.png" style="max-width: 100%;"></a></p>
<p dir="auto"><strong>Platform:</strong></p>
<ul dir="auto">
<li>Device: Desktop, Intel Core i7-10700K, Nvidia GTX 1660 Super</li>
<li>OS: Windows 11</li>
<li>Browser: Chrome Canary 97.0.4685.2, Firefox Nightly 95.0a1</li>
<li>Three.js version: r133</li>
</ul>