Thumb() causing hanging even when thumbs have been generated previously

Kirby 4 - I’m using thumb() and srcset() to generate three thumbnails for 60 images which are displayed on the page at one time.

The thumbnails are generated correctly (I’ve checked the media folder) however it’s causing the page to hang and take over 20 seconds to load, even when I’d expect them to be loaded from the cache, as they’ve been generated. This delay is not caused by browser rendering.

Removing the thumb/srcset and leaving the unmodified image file solves the issue. I suspect Kirby is taking a long time to check if the thumbnails have been generated, as the date created/modified are unchanged for the generated thumbs.

The images are within layouts – I’m looping through 10 pages, each of which has 6 image rows in a layout field.

The code used in context:

<? if($projectsPage && $projectsPage->hasChildren()) {
			foreach($projectsPage->children() as $project) {
				echo '<div>';
				$layouts = $project->layout()->toLayouts();
				foreach($layouts as $layout) {
					echo '<div>';
					foreach($layout->columns() as $column) {
						foreach($column->blocks() as $block) {
							if($block->type() == 'image') {
								$image = $block->image()->toFile();
								if ($image) { ?>
									<figure>
											<img 
											src="<?= $image->thumb(['width'=> 300,'height' => 300])->url(); ?>"
											data-src="<?= $image->url(); ?>"
											srcset="<?= $image->srcset([600, 900, 1200]); ?>" 
											alt="<?= $project->title(); ?>" loading="lazy">
									</figure>
								<?
								}
							}
						}
					}
					echo '</div>';
				}
				echo '</div>';
			}
		} ?>

Adding here that the issue turned out to be caused by Codekit (the bundler/server), not Kirby. Disabling Codekit took everything back to normal.