Live data from Hacker News

CSS3 Patterns Gallery

lea.verou.me

1–10 of 39 posts

Re: CSS3 Patterns Gallery

#7
As a technical demo they're great. In practice though, I wouldn't recommend using these techniques because:

  - Many are completely broken in FF
  - Crashed my FF (19.0.2) and strangely sent my GPU fan into overdrive
  - These techniques hurt performance badly. In the case of gradients 
    the browser has to first generate the bitmaps 
    from the gradient definitions, apply any clipping/masks 
    and then composite any other overlaying elements. 
    This is far more taxing than simply grabbing a 
    bitmap and painting into a region.

Re: CSS3 Patterns Gallery

#9

These look great, but performance is really poor.

Could you explain this? I'd figure the performance would be greater than using an repeating image for a background.

Performance is far worse because this is the equivalent of a procedural texture. With a tiling bitmap the computer simply fetches the file, then paints the pixels into a region.

With a definition such as:

  - radial-gradient(closest-side, transparent 0%, transparent 75%, #...
The browser first parses the CSS, then generates the actual bitmap data for this definition in memory then finally paints the pixels into the correct places. The in-memory bitmap generation is far more taxing than simply tiling an existing bitmap.

Then there is the issue of dynamic CSS which may cause reflow which will in turn probably require more dynamic bitmap generation.

Re: CSS3 Patterns Gallery

#10
post #9

Earlier quoted context omitted.

Could you explain this? I'd figure the performance would be greater than using an repeating image for a background.

Performance is far worse because this is the equivalent of a procedural texture. With a tiling bitmap the computer simply fetches the file, then paints the pixels into a region. With a definition such as: - radial-gradient(closest-side, transparent 0%, transparent 75%, #... The browser first parses the CSS, then generates the actual bitmap data for this definition in memory then finally paints the pixels into the cor…

One interesting thing is done while building iOS app: png images are reencoded to make them more efficient. What is done, that alpha value is premultiplied, but the more interesting thins is that bytes are rearranged from RGB to BGR . This is done to match the layout of the iPhone display, so mapping from image is even faster.
Post reply on HN