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

Fix performance issue by reusing existing wp_query object contents #437

Closed
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
4 participants
@ottok
Copy link

ottok commented Apr 26, 2018

Running get_posts() triggers a database query which is unnecessary as
the object wp_query already contains the posts, so rather reuse it
directly.

I hereby contribute this as public domain to Facebook so I don't need to sign extra agreements.

Fix performance issue by reusing existing wp_query object contents
Running get_posts() triggers a database query which is unnecessary as
the object wp_query already contains the posts, so rather reuse it
directly.
@facebook-github-bot

This comment has been minimized.

Copy link

facebook-github-bot commented Apr 26, 2018

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

@ottok

This comment has been minimized.

Copy link

ottok commented Apr 26, 2018

Before:
rekki facebook optimization before

Note the slow woocommerce_after_shop_loop() that includes this Facebook plugin.

After:
rekki facebook optimization after

Now there is one SQL query less.

Pictures are not on the same scale. The page load pictured below takes 500 milliseconds less to complete.

@mengyingdu

This comment has been minimized.

Copy link
Contributor

mengyingdu commented May 3, 2018

Hi @ottok ,

Thanks for your pull request!
Since you didn't sign the Contributor License Agreement, I need to clone/copy your change and then land internally. Is that OK?

Thanks!

@ottok

This comment has been minimized.

Copy link

ottok commented May 3, 2018

Sure, go ahead as you see fit. The mention of public domain is inside the commit itself, so you should be able to merge that as well without problems.

@dmitridr

This comment has been minimized.

Copy link
Contributor

dmitridr commented May 8, 2018

Thanks for this!! Out of curiosity what plugin/software did you use to generate those charts?

@mengyingdu closed this in c7d7575 it should be live in the next version.

@dmitridr dmitridr closed this May 8, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment