I've added a few debugLogs to see where the time goes. In getAlbumThumbImage it calls getImages.
Here it loops through the images "foreach ($images as $filename)" line 488-ish (adding the deubLogs will have slightly changed the line number)
This calls newImage which in turn calls "New _Image" this calls: parent:

ersistentObject. This call takes 15-30s typically for a CR2.
Later the block "if ($new) {} " also takes 15-30s to execute, though I haven't figured out which of the calls is taking up the time yet. While this is going on the are file related files in /tmp being used, typically a .png file is present amongst the temp files.