diff --git a/resources/blog/posts/2024/2024-09-11-improving-rector-performance.md b/resources/blog/posts/2024/2024-09-11-improving-rector-performance-by-20-30-percent.md similarity index 99% rename from resources/blog/posts/2024/2024-09-11-improving-rector-performance.md rename to resources/blog/posts/2024/2024-09-11-improving-rector-performance-by-20-30-percent.md index 10272838..63899585 100644 --- a/resources/blog/posts/2024/2024-09-11-improving-rector-performance.md +++ b/resources/blog/posts/2024/2024-09-11-improving-rector-performance-by-20-30-percent.md @@ -1,6 +1,6 @@ --- id: 72 -title: "Improving Rector Performance" +title: "Improving Rector Performance by 20-30 %" perex: | Today I want to talk about how I added an optimization that made Rector 20-30% faster! @@ -98,6 +98,8 @@ As you can see, we don't pre-calculate the rules to be used for every single kin When I was working on this code, before I tested it I was hoping for a performance gain of 5%-10%, so I was really happy when my tests returned a performance gain of 20-25%. This was later confirmed by Tomas Votruba, Abdul Malik Ikhsan and Markus Staab who measured similar or even greater gains. +
+ I am really proud to have been able to add this improvement to Rector. I have always said that this tool is the best thing that has happened to the PHP ecosystem in the most recent years and I am always happy to see ways to improve it. And now all Rector users will benefit from much shorter runs. One part of this that makes me specially happy is to think about the carbon footprint implications of this change. Rector is a tool used by thousands of developers which must be run thousands of times a day. This means that this improvement will end up saving many millions of minutes of execution, which means helping to lower the carbon footprint of this tool in a very significant way. diff --git a/src/Controller/Socials/PostThumbnailController.php b/src/Controller/Socials/PostThumbnailController.php index 2b62eac2..c9843578 100644 --- a/src/Controller/Socials/PostThumbnailController.php +++ b/src/Controller/Socials/PostThumbnailController.php @@ -47,8 +47,11 @@ private function createImage(string $title, string $imageFilePath): void $greenFont = $this->thumbnailGenerator->createFont(FontFile::INTER, '59a35e', 40); $post = $this->postRepository->findByTitle($title); + if (! $post instanceof Post) { + return; + } - if ($post instanceof Post && $post->getAuthor() === 'samsonasik') { + if ($post->getAuthor() === 'samsonasik') { $authorName = 'Abdul Malik Ikhsan'; $authorPicture = __DIR__ . '/../../../public/assets/images/samsonasik_circle.jpg'; } elseif ($post->getAuthor() === 'carlos_granados') {