Browsers have always been quite complex pieces of software. But as the web becomes more and more capable, it's the browsers' job to bring those capabilities to users.With 3D graphics, real-time video communications, and many other such features, browser makers are finding themselves tackling increasingly complex problems.
Five years ago, talking about frame rates or Vsync on the web would have been nonsense. Now, those terms are as relevant to web app developers as they are for game makers.
Case in point, Firefox has only now added support for Vsync. The feature is only supported by Firefox Nightly on Windows, but the fact that it is supported at all speaks volumes about the state of the modern web.
"Vsync has finally landed on Windows Nightlies not long ago. This means that Firefox will now synchronize its paints with the actual refresh rate of the monitor (if available), which is essential for properly smooth animations," Mozilla's Avi Halachmi wrote.
"This will work (and is enabled by default) on Windows Vista and later with DWM enabled ('Aero' themes). This also works with WebGL content such as Epic Citadel (demo)," he added.
Most displays today use 60Hz refresh rate, i.e. the image is updated 60 times a second, but not all. Some use 50Hz, some TVs use 100Hz, and so on.
So far, Firefox has used this value by default, without actually checking if it is the value used by the display.
Now though, Firefox will be able to determine the refresh rate of the display and use that value instead.
In the current implementation, which only works on Windows Vista or higher, Firefox only checks the refresh rate of the main display, so people with multiple monitors may encounter some issues.
By default, Firefox Nightly will try to use Vsync, but users can specify a value themselves in about:config via the "layout.frame_rate" option. "-1" means Vsync or 60Hz if Vsync is unavailable. Any other value above 0 will force that refresh rate.