WebKit upgrade improves memory usage

try {
threshold : 0, // You can set threshold on how close to the edge ad should come before it is loaded. Default is 0 (when it is visible).
forceLoad : false, // Ad is loaded even if not visible. Default is false.
onLoad : false, // Callback function on call ad loading
onComplete : false, // Callback function when load is loaded
timeout : 1500, // Timeout ad load
debug : false, // For debug use : draw colors border depends on load status
xray : false // For debug use : display a complete page view with ad placements
}) ;
catch (exception){
console.log(“error loading lazyload_ad ” + exception);

, has been upgraded with a new bytecode format that improves memory efficiency and type safety.

The goal of the format, , was to reduce memory consumption and allow the bytecode to be cached on disk. The WebKit team claims the new format uses 50 percent less memory on average, which translates to an overall 10 percent reduction in memory usage for JavaScript-heavy websites such as Facebook or Reddit.

Two big changes were cited as part of the new format:

  • There is no longer a separate linked encoding for execution. This means bytecode can no longer be direct threaded, since the address of the instruction could not be stored to disk, as it changes with each program invocation.
  • To make the single format suitable for both storage and execution, instructions can be encoded as narrow or wide. With a narrow instruction, the opcode and operands each take one byte. A wide instruction consists of a special single-byte opcode, op_wide, followed by a series of four-byte slots for the original opcode and its arguments.

The new bytecode also features a metadata table. When linking, a side table is initialized with all writeable data associated with a given instruction. In addition, type safety was increased through improvements to bytecode-related infrastructure. A caching API for the new bytecode is in development in the WebKit repo. Developers can contribute at .

Developers involved with the project had sought to fix two major issues with the old bytecode format. First, it used too much memory, and second, it included an instruction stream that was writeable, which prevented memory-mapping the bytecode stream. The old bytecode format also had optimizations that were no longer beneficial, such as .

The new bytecode format is available on the Safari 12.1 browser, which shipped with iOS 12.1 and MacOS 10.14.4, and the Safari Technology Preview. You can from .