Hey, it

Apple WebKit engineers Benjamin Poulain and Simon Fraser have offered advice to web developers on how to design web pages that save energy, preserve battery life of mobile devices and give users time to interact with the Web content.

"Web developers rarely think about the use of energy, but they really should," said Fraser, via Twitter.

WebKit is the browser's rendering engine in the heart of Apple's Safari browsers for mobile and desktop devices, but the tips presented by its programmers apply to web pages presented in any browser, for the most part.

The display screens of mobile devices, CPU, GPU and network hardware represent the main components that consume a lot of energy, explain Poulain and Fraser in a blog post, but from the screen configurations such as brightness tend to be determined by The user and fairly consistent, urge web developers to focus on how their code interacts with the other three components.

They advise developers to consider energy consumption When users actively interact with content, when the page is in the foreground without interaction and when the page is hidden.

& # 39; Optimizations & # 39;

"You want the page to load quickly and respond quickly to touch." state. "In many cases, the same optimizations that reduce the time for the first paint and the time for the interactive user will also reduce energy use."

And after everything has been loaded, they say, the goal should be to be inactive again as quickly as possible.

The use of JavaScript, as far as possible, should be minimized. "In general, the less JavaScript is executed, the more efficient the energy consumption of the page will be, since the script works above what the browser has already done to design and paint the page," they say.

Use of inactive power should be conducted to zero minimizing the time the CPU wakes up. Also, animations should not run continuously: APIs like IntersectionObserver can help here by running animations only when they are visible. Declarative animations (CSS transitions and animations) should be preferred over inefficient script-guided ones. And WebSocket or Fetch with a persistent connection should be used instead of network polling.

WebKit can help by automatically accelerating timers and stopping requestAnimationFrame calls and CSS and SVG animations when a page becomes inactive. Apple's iOS and macOS operating systems can increase savings by suspending eyelash processes. But developers should take advantage of tools such as the API PageVisibility and techniques such as event monitoring to stop operations that consume a lot of energy whenever possible.

Google Chrome, it should be said, has some energy-saving advantages of its own. For example, the recently implemented deferred load image attribute, which avoids loading images that would not be visible in the current browser view, landed in Chrome 76 but is not yet available elsewhere.

Poulain and Fraser also recommend that developers make use of the Safari Web Inspector to optimize the CPU usage for a given page layout.

Keep it simple

When it comes to reducing the power of the network, the duo advises using the browser cache instead of requesting resources over the air whenever possible and grouping network requests, since small transmissions and Frequent require unnecessary and repeated electrical overload.

Browsers can be as important in saving energy as an efficient browser code. Instead of urging developers to fight for a more energy-efficient design, convince users to leave a browser that consumes a lot of energy like Chrome in favor of a more economical browser like the previous version of Microsoft Edge's Chromium or the current version of Brave represents another option, not to mention the overall energy benefit of ad blocking and tracking scripts.

Energy efficient navigation is not a new concern. In 2012, Stanford Boffins published a research paper that showed that simply by modifying the scripts on the Wikipedia mobile site, readers could achieve a 30 percent energy reduction.

  Apple Safari icon

Apple WebKit technicians declare that circumvention of privacy is a security issue

READ MORE

Among the websites they tested, the worst in terms of energy consumption It was, ironically, Apple.com, that researchers noticed that it was particularly hungry for energy because it was not optimized for mobile devices and included large CSS files, many images and inefficient JavaScript.

"On Apple's homepage, for example, the JavaScript used to track the user's location generates an update that forces the phone to set up a 3G connection," the document explains. 19659002] "Therefore, despite the caching, the energy consumption for these 10 sites was almost as high as when the caching was not performed. Here is an important lesson for designing mobile websites: the Dynamic JavaScript can increase the energy usage of a page. "

It is clear that Apple seems to be learning its lesson ®

For More Updates Check out Blog, Windows Softwares Drivers, Antivirus, Ms Office, Graphic Design Don’t Forget to Look Our Facebook Page Get Into Pc like us & follow on Twitter- @getinpc

Please Note: This content is provided and hosted by a 3rd party server. Sometimes these servers may include advertisements. igetintopc.com does not host or upload this material and is not responsible for the content.