picocms / Pico

Pico is a stupidly simple, blazing fast, flat file CMS.
http://picocms.org/
MIT License
3.81k stars 616 forks source link

Suboptimal process of process pages id #671

Closed zeleznypa closed 12 months ago

zeleznypa commented 1 year ago

The content folder (.../content) and extension (.md) is fixed for every pages, so it is not necessary to count the string length of the extension for every page.

https://github.com/picocms/Pico/blob/09aa82578710d82dd7dc482febe32991be0ea307/lib/Pico.php#L1739

It will be better to count it once before the foreach and use the result everytime ...

$contentDirLen = strlen($contentDir);
$contentExtLen = strlen($contentExt);

foreach ($files as $i => $file) {
   // ...
   $id = substr($file, $contentDirLen, -$contentExtLen);
github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in two days if no further activity occurs. Thank you for your contributions! :+1:

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in two days if no further activity occurs. Thank you for your contributions! :+1:

PhrozenByte commented 1 year ago

Interested in opening a PR against the pico-3.0 branch?

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in two days if no further activity occurs. Thank you for your contributions! :+1: