Skip to content
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

Question on Performance #117

Closed
RaphaelKunis opened this issue Oct 10, 2019 · 5 comments · Fixed by #135
Closed

Question on Performance #117

RaphaelKunis opened this issue Oct 10, 2019 · 5 comments · Fixed by #135
Milestone

Comments

@RaphaelKunis
Copy link
Contributor

Hi,
i am using photobooth for a while, first on a pi zero and now on a pi model 3B+.
If I use the plain git version it takes approximately between 8 and 11 seconds even on the 3B+ to show the picture in browser after the picture was taken by camera.

This is a bit long in my oppinion.
How long does it take with your installation?
Do i need to do some environment changes to my pi?

My current solution to solve this is

  • to totally disable gallery and image processing when gallery is not used (no thumbnail creation and no image changes),
  • to disable qr code creation and to turn of qr code creation when qr is disabled and
  • to set the picture quality to produce approximately 3 MB pictures.

This leads to a processing time of 5 to 7 seconds.
My configuration is a Pi Model 3B+, with a Canon ES 600d camera.
Raspbian Buster
Gphoto: gphoto2 2.5.23, libgphoto2 2.5.23

@sualko
Copy link
Collaborator

sualko commented Oct 11, 2019

Here are some numbers, taken from a default installation (without collage/filter) on a Raspberry 3 (all times in seconds):

  • Execution time takePic.php: 8.737024869918823
  • Time until picture is taken and stored to disk: 1.5764682292938232
  • Load image (imagecreatefromjpeg): 0.8934361934661865
  • Resize for chromakeying: 4.136002063751221
  • Thumbnail generation: 2.0890421867370605
  • Write thumbnail: 0.01137089729309082

If I apply a filter the execution time rises to ~15.7 seconds which is way to much. Our aim should be to show the original image as fast as possible and to generate thumbnails and apply filters in the background. This will of course not go into 2.0, but I will consider it for 2.1. Thanks for reporting.

sualko added a commit that referenced this issue Oct 11, 2019
also minor performance optimization (related #117)
@sualko sualko added this to the v2.1.0 milestone Oct 11, 2019
@mhellmeier
Copy link
Contributor

Jip, this question / issue is mostly based on the software part. I will test it with a new Raspberry Pi 4 Model B with 4GB RAM soon.

Remember that the SD card speed of your camera and raspberry pi is also in important point. With a fast r/w card you can get some speed improvements.

@sualko
Copy link
Collaborator

sualko commented Oct 18, 2019

I was able to make the image taking process a lot more responsive (preview is shown after 1.7s) and to improve the overall performance. As seen above one of the biggest issues was the resizing. Therefore I tried different solutions and as you can see, there are way faster methods (with a similar quality).

  • GD (imagecopyresampled): 3.7123539447784
  • GD (imagescale with triangle filter): 0.96465301513672
  • Imagick (resizeImage with triangle filter): 1.6898829936981
  • Convert: 3.9750638008118

With the new resize method, the thumbnail and chromakeying generation, are now ~75% faster:

  • Resize for chromakeying: 1.1182799339294434
  • Thumbnail generation: 0.48159098625183105

@mhellmeier
Copy link
Contributor

How long does it take with your installation?

I just tested it on a new Raspberry Pi Model 4B with 4GB of RAM and a pretty fast (and expensive 😆) SD card. It took around 9 seconds to take a normal picture and around 14 seconds to take a picture with a filter.

If I compare my results with the maximum of 11 seconds from @RaphaelKunis and 15.7 seconds from @sualko I would say that adjusting the hardware will also give a slightly performance improvement.

If you are interested I can also share my execution times after applying this PR.

(Remember that I tested with version 2.0.2, that's before this PR was merged).

@sualko
Copy link
Collaborator

sualko commented Oct 30, 2019

If you are interested I can also share my execution times after applying this PR.

Would be nice to know. 👍

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

Successfully merging a pull request may close this issue.

4 participants