Skip to content

Instantly share code, notes, and snippets.

@paulirish
paulirish / what-forces-layout.md
Last active July 18, 2026 01:45
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@yadvr
yadvr / my.cnf
Created July 27, 2015 10:19
Example MySQL my.cnf optimized
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock
# This was formally known as [safe_mysqld]. Both versions are currently parsed.
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0
syslog
# expects seconds, returns pretty string of how long ago event happened
def ago(seconds)
a = seconds
case a
when 0 then "just now"
when 1 then "a second ago"
when 2..59 then a.to_s+" seconds ago"
when 60..119 then "a minute ago" #120 = 2 minutes
when 120..3540 then (a/60).to_i.to_s+" minutes ago"
when 3541..7100 then "an hour ago" # 3600 = 1 hour