The Truth(tm) about encoding SVG in data URIs

tl;dr: You can stop worrying and URL-encode only the # character. What? So you want to have an SVG image in a CSS stylesheet. Yup, using data URIs (hey lookie, a 2009 post). There are a number of reasons not to embed images in CSS to begin with (caching, reuse), but hey, sometimes you’re not […]

February 9th, 2024
Tags: CSS, images

How many bytes is “normal” for a web font: a study using Google fonts

TL;DR: If your font file is significantly larger than 20K you may ask yourself “How did I get here?”. For images I think we (web developers) have a sense of how many bytes we can expect an image we see on a page to be. A JPEG photo? 100-ish K is ok for a decent […]

January 23rd, 2024
Tags: font-face, performance

Font-face toggler bookmarklet

Ever wanted to look at your page and turn Web Fonts on and off? Experience the layout shift repeatedly, like some sort of UX torture? Look no further, here comes the handy bookmarklet. Install Drag this link to a bookmark toolbar near you: toggle fonts Use Go to a page with web fonts and click […]

January 8th, 2024
Tags: font-face, performance

Image requests in hidden content

You know the pattern: spit out some markup, probably server-side, but hide it for later. On-demand features (not to overwhelm the UI), dialogs waiting to pop, and so on. <div class=”modal hidden”>content here…<div> And what happens when the “content here…” includes resources, such as images? Is the browser going to download them? Let’s check. What […]

January 1st, 2024
Tags: images, performance

Minimum viable no-image image src

Remember spacer.gif? Yeah, “good” old days… We may now have all the CSS features to make everything better but sometimes the ghost of spacer gif rears its transparent head. And that’s an HTTP request. A request that’s better devoted to something useful. Like an LCP image or something, I dunno. So anyway, sometimes a simple […]

December 26th, 2023
Tags: images, performance

Perfplanet calendar ’23 call for articles

Hello, dear reader and web performance enthusiast! It’s time to sit down and write an article for the performance calendar. Here are some more details. Or if you’re not feeling like writing, look around you and recruit the person you think should share their knowledge with the world. What can you write about? Just share […]

November 2nd, 2023
Tags: News/personal, performance

A quick study of PDF optimization

Couple days ago I found out about a tool called pdfcpu, a PDF processor. Among its features I saw “optimize” so I had to take it ot for a spin and see how much of an optimization we’re talking about. Here’s a quick study of optimizing a random-ish sample of PDF files. Source data I […]

August 17th, 2023
Tags: performance, tools

Running JPEG-XL tools on shared Dreamhost

Let’s see how to setup and run cjxl (and its sibling djxl) on a simple shared hosting provider so you can encode and decode JPEG-XL (aka JXL) images. How There are better ways to install libjxl and its command-line tools but they require you to have sufficient privileges on your computer or server. With inexpensive […]

July 20th, 2023
Tags: hosting, images, tools

Fixing INP with a VIEWPORT tag

So I woke up yesterday being scolded by Google. An email from Google Search Console Team with subject “Core Web Vitals INP issues detected on your site”. Huh?! It was about this WordPress-powered site that you’re reading now (phpied.com). The Interaction to Next Paint metric (INP for short) was in the “Needs improvement” category as […]

July 12th, 2023
Tags: performance

A circle of web performance innovation

Inspired by Harry Roberts’ research and work on ct.css and Vitaly Friedman’s Nordic.js 2022 presentation, Rick Viscomi hacked up a tool (a JS snippet) called capo.js that can do what Harry says. Next logical step is to test the results of the tool in a no-code experimental setting and see if the results make sense […]

May 21st, 2023
Tags: performance

Lighthouse diff + WebPageTest

Lighthouse (LH), the performance auditing tool from Google now has a diff tool so you can compare what happens before/after a change or me vs competitor types. And WebPageTest.org (WPT), the industry-darling web perf analyzer, also runs Lighthouse and in addition to presenting the results (in two different ways, actually) you can export the results […]

May 9th, 2023
Tags: performance

Jehl’s Law of Web Performance

Adam Fendrych reported that Scott Jehl said in his Web Expo talk that a website should load before you can say “Cumulative Layout Shift”. What does that mean in practice? We’re web performance specialists here, we work with measurements and numbers, so we need a more exact number. Numbers reduce ambiguity. To find out that […]

April 21st, 2023
Tags: performance

Quick BPP (image entropy) check

Chrome is making a change on how Largest Contentful Paint (LCP) core web vital (CWV) is being calculated in order to avoid abuse. The abuse is that people cheat by putting a fake “hero” image (imagine a stretched out 1×1 transparent gif) and have this counted as a sooner LCP event. Chrome is fighting this […]

April 13th, 2023
Tags: performance

Progressive

Details from a talk to NYWebPerf meetup will go here after the talk. For now there’s: github.com/stoyan/progressive with the code and slides

July 26th, 2022
Tags: images

Faster WordPress rendering with 3 lines of configuration

“When I was younger, so much younger than today” and upset and full of vinegar about the state of the world, I’d say things like “CSS is the worst” (not really). Now, half a year later, older and wiser and more accepting, I’d agree to mellow down to “CSS is render-blocking”. Un-render-blocking CSS What this […]

July 2nd, 2022
Tags: HTTP, performance, tools

Write to an Airtable with PHP

Lately I’ve been rediscovering the joy of PHP. Also been helping an MVP get off the ground which uses a lot of nocode/lowcode bits and pieces and miraculously puts them together. Anyway, I had to write to an Airtable table with PHP and some quick googling didn’t find an example to copy-paste so I’m writing […]

February 21st, 2022
Tags: api, php

Perfplanet calendar ’21 call for articles

Helloooo, dear reader and web performance enthusiast! It’s time to sit down and write an article for the performance calendar. Here are some more details. Or if you’re not feeling like writing, look around you and recruit the person you think should share their knowledge with the world. What do you want to write about? […]

November 26th, 2021
Tags: performance

Perfplanet calendar’s oldies but goodies

Thomas Steiner has a brilliant idea for this year’s Perfplanet calendar edition: what if we revisit some of the best articles from the past. “Best” is subjective but how about “still popular”? So here’s a list of the 31 most visited articles in the past year in reverse chronological order of publication. (31 as the […]

November 3rd, 2021
Tags: performance

ffmpeg: make a video with a static image and an audio file

tsia ffmpeg -loop 1 -i image.png -i audio.mp3 -c:a copy -c:v libx264 -shortest result.mp4

July 6th, 2021
Tags: ffmpeg

Video grids with ffmpeg

I wanted to create a video that is a 3×2 grid of 6 other videos. This one to be precise: I was hoping I can use ffmpeg, because the thought of using a proper video editing software gives me the chills. In fact at some point I thought things will require iMovie and went to […]

December 7th, 2020
Tags: ffmpeg

Randomizing music with MuseScore and Node.js

One of my esteemed professors from Santa Monica College, Dr. Driscoll asked for an opinion on how one can use a sheet of music and reshuffle some measures to generate a unique exercise for each student. This turned out more fun than anticipated and here’s a solution I came up with using the free notation […]

September 13th, 2020
Tags: JavaScript, Music

Natively lazy-loading Facebook social plugins

tl;dr: Add data-lazy=”true” to your Facebook social plugins that are below the fold and reap the benefits. In code: // before <div class=”fb-like” data-href=”https://phpied.com”></div> // after <div class=”fb-like” data-href=”https://phpied.com” data-lazy=”true”></div> The following 18 seconds video demonstrates the difference. Where currently your visitors load Facebook iframe content even if it’s way down the page, after you […]

July 24th, 2020
Tags: facebook, JavaScript

Life after Facebook?

Yesterday was my last day at Facebook. After 9 1/2 years it was high time for a change. I dropped the news on twitter/fb and thought now it would be nice to answer the question of “what’s next?” that friends are wondering. The trajectory I myself have wondered sometimes what the life after Facebook could […]

July 14th, 2020
Tags: News/personal

A programmer’s job dimensions

I’m not the one who philosophizes often in public, but indulge me this thought on the types of work we do as programmers and feel free to add your own dimensions. I’ve thought about how sometimes I like to work on user-facing products and sometimes on developer-facing ones. Real products that my mom can see […]

May 14th, 2020
Tags: News/personal

WebAudio Deep Note, part 5: gain node

Previously on “Deep Note via WebAudio”: intro play a sound 2.1. boots and cats loop and change pitch multiple sounds nodes In part 4 we figured out how to play all 30 sounds of the Deep Note at the same time. The problem is that’s way too loud. Depending on the browser and speakers you […]

November 9th, 2019
Tags: JavaScript, WebAudio