Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Old Slide Deck About Images
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Mike Danko
July 24, 2013
54
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Old Slide Deck About Images
Mike Danko
July 24, 2013
More Decks by Mike Danko
See All by Mike Danko
Stop Being Clever
skord
0
110
I Hate Computers
skord
0
120
Deploying Ruby/Rails Apps to AWS
skord
1
120
Brad vs Goblin
skord
0
90
jRuby for Web People
skord
0
84
Rails on Solaris and Friends
skord
0
120
Jaccard Index & Recommendable
skord
1
190
State of Conclave
skord
0
89
Space Hustling
skord
1
77
Featured
See All Featured
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
2.2k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
232
55k
Darren the Foodie - Storyboard
khoart
PRO
4
4k
What does AI have to do with Human Rights?
axbom
PRO
1
2.5k
Reality Check: Gamification 10 Years Later
codingconduct
0
2.3k
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
74
43k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.4k
Color Theory Basics | Prateek | Gurzu
gurzu
1
490
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.9k
Optimising Largest Contentful Paint
csswizardry
37
4k
Music & Morning Musume
bryan
48
7.4k
From π to Pie charts
rasagy
1
400
Transcript
Performance Image Processing with Ruby And Friends
Who? • TWC Systems Engineer • Network/Systems/Video Integration. Mostly Video.
• Puts pic on slide, even though he’s standing right there.
Who? • Artisan/Grill Fairy/Beer Czar at Neo • Rails and
Stuff • Puts pic on slide, even though he’s standing right there.
Why Does it Matter?
Small Site Operator • Difference between free and not on
Heroku • More time for requests • Less of a chance of hitting the magic 30 second mark
Everyone Else • More efficient workers == Less $$$ •
Faster response == More $$$ • Less time doing the mundane means more time for the interesting.
Peer Pressure • A simple gem change can improve performance
by 220% • Another 15 minutes of work can offload uploads completely • It’s easy, come on.
When Not To... • You’re on jRuby • Your processing
needs are complex • You think you’re doing it right
Getting the Images
People Uploading • Don't tie up Ruby time • Given
Workers, go direct to S3 when you are using S3 • Use nginx’s upload module if that’s your bag
Basics • Your IO will block somewhere, avoid the CPU
• Decoupling IO from processing will do you wonders. • Use workers to your advantage
If You Give A Mouse an Image... • ImageMagick •
GraphicsMagick • ImageSorcery • ImageScience • OpenCV • For the brave... Intel IPP
No Processor is Alike • And they’re mostly really inefficient.
The Rundown
Backing Methods • Pure Ruby: ChunkyPNG • C: RMagick, ImageScience
• Subexec: MiniMagick, QuickMagick • Hybrids: ChunkyPNG/OilyPNG
Something Bothered Me • Went about profiling and benchmarking Ruby
• Went about profiling and benchmarking GM/ IM • Why is something as simple as changing the size of a picture so complex?
ruby-prof breakdown 0 20 40 60 80 Sorcery (IM) Sorcery
(GM) Science Mini (IM) Mini (GM) 73 40 0 0 0 14 20 0 10 12 0 31 14 23 28 23 30 16 22 34 Fit Fill Pad Slice Gif
None
None
Rules of Thumb • Use ImageScience whenever you can •
Next default to subexec’d GM • Use multiple gems if you need to, or patch an existing one. • Avoid calling IM/GM more than once per run