New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Performance is Sluggish #1493
Comments
@smartass101: Any thoughts on this topic? @mlissner: Sidestepping the question of performance and focusing squarely on the "[this] is just too much for fast iteration while I'm writing" portion of your issue description, you can use the |
Thanks, @justinmayer. I've played with The obvious way for it to work would be:
But that doesn't create any posts. I've tried about 20 other semi-logical approaches too. None create posts. Can't figure it out. |
Fairly certain the docs mention that the target is the path to the generated file in question — not the source document. |
I started hacking something; I believe the max recurtion is due to how the comparison works on URLWrapper classes. If we pass the However, I 'm not sure why the tests are failing now … |
One reason why I think One approach I use to cut down on the calls is that via a plugin I set the override attributes so that they aren't always dynamically created. But that works only because I know it won't break the setup I use. article.override_url = article.url
article.override_save_as = article.save_as |
@justinmayer I played with @ametaireau, @smartass101, it looks like you two are making progress on the performance issue. I'll stay out of the way so we don't duplicate effort. Let me know if I can help. One other performance thought I had is that I'm losing a lot of speed to copying static files. Have we looked at creating hard links instead? |
I realize I've been going off on tangents. I moved the hardlinks discussion over here: Sorry about that -- a bad tendency of mine. |
@mlissner: I believe this has been addressed. If you feel otherwise, please comment here, and I'll re-open. |
Great news. I probably won't be profiling this again, but I'll keep my eye out for improvements next time I'm working on a post. Is there a commit I can check out or a PR where this was completed? |
Was referring to caching in general, as well as Alexis's commit noted above. |
I could be mistaken, but I don't think the commit above has been merged: https://github.com/getpelican/pelican/compare/fix-1493 |
Here's a comparison of 3.4.0 and 3.6.0, which looks like it just landed on pip. This creates a lot of output, so I've only included stuff that takes more than half a second. For reference, this is on an i7 laptop with 12GB of RAM and an SSD. First, 3.4.0:
Then, 3.6.0:
Looks like pretty good improvements. We're still running slugify over 1,000 times per page, which seems insane, but the performance is faster for some reason. |
can you add one where you compare a 3.6 with no cache and 3.6 with generator caching as well? Thanks for the data! EDIT: is that with any plugins? |
Sure. How do I turn on generator caching? On Mon, Jun 15, 2015, 23:00 winlu notifications@github.com wrote:
|
keep in mind that the first time this won't have any effect (as there is no cache), the second time it should load the appropriate cached content |
#1701 doesn't provide any performance improvement by itself because the slugs for Regarding the number of Also, these are all connected:
Numbers are excessive for sure, but I doubt this is purely from pelican's internals. If theme is doing some comparisons to @mlissner is your site source public? If so, I could examine it and maybe see if there is room to improve. |
Here's another run after I set the variables mentioned by @ingwinlu and ran it twice:
Not sure what the warning means, but HOLY COW, that's a massive improvement. @avaris, yes, my site is public. You can find it here: https://github.com/mlissner/michaeljaylissner.com/. Any thoughts you have would be more than welcome. |
@mlissner not sure what happened there but, yes, doing nothing is usually fast :).
BTW, thanks for the link. I'll see what I can do. |
@avaris, curious. I literally ran it twice in a row. Seems like the caching worked? |
@mlissner nope, that's not how caching is supposed to work. Cache eliminates reading unmodified input again, pelican should still process articles and pages to generate output. |
Oh. Well, that makes sense, and it's friggin' excellent. I hope it's enabled by default. Look forward to what you learn looking over the site. |
In 3.5, caching was enabled by default. But some users would be surprised when they made changes to their settings file and didn't see those changes reflected... due to the caching. So we just changed the default in 3.6 to caching disabled. This jives better with the "principle of least astonishment", and folks with large sites can enable it easily by adding a few lines to their settings file. |
@mlissner I looked at your site. It was actually the theme that was causing absurd amounts of But, if you want a quick fix before that's merged and released, you can change that |
Thanks @avaris, for looking into this! I filed a bug in pelican-elegant, and tried to get in touch with the maintainer to get some movement going there. Hopefully we'll get this bottleneck fixed! |
Since I started using Pelican, I've been a bit annoyed how long it takes for it to generate my content. Right now it takes Pelican about 15s to generate my site (225 posts), which is just too much for fast iteration while I'm writing.
I dug out a profiler this evening and did a little test:
This gave me some output that indicated that the
slugify
function was called a whopping 300,504 times on my puny blog!I'm not an expert on profiling, but if I'm reading this right, it looks like the slowest thing is writing to disk (I have an SSD!) and the second slowest is the
slugify
function, which took over ten of the 21 seconds.I started picking at
slugify
in hopes of making it faster. One idea from an IRC chatroom was to memoize the function, but when I tried that using@functools.lru_cache(maxsize=2048)
, it threw:And I found the
memoize
decorator inutils.py
, but it threw an error too.I guess this is a bug report to say:
I'm going to move on to other things until I hear back here, but if we can get a conversation going, I'll be happy to try to make this faster.
The text was updated successfully, but these errors were encountered: