hi, i ran into a similar problem with ~130 virtual pages and used GitHub - bnomei/kirby3-stopwatch: Profile your Kirby 3 CMS code with precision in milliseconds (or seconds) to hunt for the bottleneck. in my case it was the creation of the array with the page models to feed the factory that slowed stuff down. so i used GitHub - bnomei/kirby3-lapse: Cache any data until set expiration time from the same author to cache the results and the site got much faster. i am still struggling with enabling APC-cache on my provider (mittwald) though and felt the docs are quite sparse at this point. anyway, here’s the relevant code from my page model:
public static function pagesforResult($result, $parent = null)
{
$key = crc32(implode($result->toArray(function ($v) { return $v->kirby_slug().$v->video_modified(); }))); // unique key: kirby-slug+modification-date of all db-results
$videos = Lapse::io($key, function () use ($result) {
$videos = [];
$num = 1;
if ($result) {
$title = static::KIRBY_TITLE;
foreach ($result as $video) {
$videos[] = [
'slug' => $video->kirby_slug(),
'num' => $video->kirby_status() === 'listed' ? $num : null,
'template' => 'video',
'model' => 'video',
'content' => [
'title' => $video->$title() ?? 'New Video',
'video_title' => $video->$title(),
'video_title_de' => $video->video_title_de(),
'kirby_status' => is_null($video->kirby_status()) ? 'draft' : $video->kirby_status(),
'video_description' => $video->video_description(),
'video_description_de' => $video->video_description_de(),
'video_description_alt' => $video->video_description_alt(),
'video_description_alt_de' => $video->video_description_alt_de(),
'video_year' => $video->video_year(),
'festival_slug' => static::slugForID('festivals', 'festival_id', $video->festival_id()), // kirby single-select does not support INT as keys due to PHP quirk: revert to festival_slug (=iso2)
'video_maincategory_slug' => static::slugForID('categories', 'category_id', $video->video_maincategory_id()),
'video_categories' => static::hasManyForId('videos_to_categories', 'category_id', 'video_id', $video->video_id()),
'video_duration' => $video->video_duration(),
'video_crop' => $video->video_crop(),
'video_format' => $video->video_format(),
'video_language' => $video->video_language(),
'video_language_de' => $video->video_language_de(),
'video_attributes' => $video->video_attributes(),
'video_attributes_de' => $video->video_attributes_de(),
'video_courtesy' => $video->video_courtesy(),
'video_courtesy_de' => $video->video_courtesy_de(),
'video_award' => $video->video_award() === 'true' ? 1 : 0,
'video_artists' => static::hasManyForId('videos_to_artists', 'artist_id', 'video_id', $video->video_id()),
'video_countries' => static::hasManyForId('videos_to_countries', 'country_id', 'video_id', $video->video_id()),
'video_trailer_url' => $video->video_trailer_url(),
'video_additional_videos' => $video->video_additional_videos(),
'video_created' => $video->video_created(),
'video_modified' => $video->video_modified(),
'video_id' => $video->video_id() // darstellung im panel nur zur info
]
];
$num++;
}
}
return $videos;
});
return Pages::factory($videos, $parent);
}