Skip to content

Conversation

@roryqueue
Copy link
Contributor

NOT READ TO MERGE but progress on #289 ... there doesn't seem to be a great package out there to get height and width etc. for png, gif, and jpeg images without bringing in a big dependency e.g. ImageMagick, so I wrote a lot of it by hand after reading through the code of several packages on Awesome-Elixir. Still needs test coverage, parameter tweaking, error handling, and edge case coverage, but let me know if I'm off track and any steering is needed.

@joshsmith
Copy link
Contributor

Any idea what the performance implications are here?

@roryqueue
Copy link
Contributor Author

Not really, but that's something I can test.

@joshsmith
Copy link
Contributor

You can use benchfella.

@roryqueue
Copy link
Contributor Author

sounds good, will do, thanks for the tip!

@roryqueue
Copy link
Contributor Author

Apologies for the delay, I've been traveling in Morocco and the rocky internet situation I had made it tough to progress. Really feel for those devs in countries with weak infrastructure. Anyways, here are the results:

## ImageBench
benchmark name         iterations   average time
get_gif_still_stats         50000   55.53 µs/op
get_png_normal_stats        20000   84.29 µs/op
get_gif_moving_stats        20000   101.25 µs/op
get_jpeg_normal_stats        5000   359.24 µs/op
get_png_large_stats          5000   378.44 µs/op
get_jpeg_large_stats         1000   2445.87 µs/op

In summary, I'd somewhat unscientifically say it should add single digit milliseconds to a POST in a ~99th percentile scenario.

Work here: https://github.com/roryqueue/code-corps-image-bench . Please let me know if you see a flaw in this measurement methodology. I basically just copied over the incremental code that will run but I certainly may have missed something.

@joshsmith
Copy link
Contributor

@roryqueue looks really good!

We'll also want to consider bringing this in ASAP and working through how, precisely, to do it for Ember:

stavro/arc#125
https://github.com/stavro/arc/wiki/Direct-to-S3-Uploads

@roryqueue
Copy link
Contributor Author

Gotcha, yeah that sounds good to me. Been digging through the linked for a bit. Am I off track to think we would actually want to use something like this: https://github.com/benefitcloud/ember-uploader#uploading-to-s3 to upload the image, translating the code in this PR to the Ember app in its entirety, and then just send the s3 image path to the Phoenix app?

@roryqueue
Copy link
Contributor Author

Oh we'd probably have to sign the upload with a request to Phoenix before the Ember -> S3 step as well, right?

@joshsmith
Copy link
Contributor

@roryqueue sorry I fell off the wagon on this one. I'm not quite positive, to be honest. Would love some deeper research into it to know for sure.

@roryqueue
Copy link
Contributor Author

On vaca now with limited computer access, but I can look into this next week if needed!

@joshsmith
Copy link
Contributor

@roryqueue absolutely! Enjoy the vacation.

@joshsmith
Copy link
Contributor

Closing this because we switched to Cloudinary from using arc and arc_ecto altogether. Thanks for work @roryqueue and sorry for having to close.

@joshsmith joshsmith closed this Feb 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants