Lighter script code, and calls between scripts that run as ordinary calls
A memory release with a look ahead. A page's scripts are kept as text for as long as the page is open (the browser needs that text to show a function's source and to point at the line an error came from), and a large site keeps megabytes of it. Floati now keeps that text compressed while the page is idle, functions that spell the same parameters share one copy of them, and the bookkeeping the fast compiler keeps for every function is made only when a function is first called. Small pictures far down a page, or hidden in menus, now give their memory back the way large ones already did. Underneath, a call from one script into a function that another script compiled separately (code made by eval, for example) now runs as an ordinary call instead of starting a new run each time, so it is cheaper, keeps a full error trace and reaches the fast compilers. That is also the groundwork for the next big step in memory: compiling a function only when it first runs. On a typical large page about 70 percent of the compiled code is never run. That feature is built and tested in this release but stays switched off until it is as fast as it is light (today it saves about 4 percent of memory on script-heavy pages and costs about 6 percent of script time). Next, Floati turns to finishing the web platform itself: the remaining Web APIs and DOM interfaces, measured against the reference browser.
Script code takes less memory
Three changes to how Floati stores a page's scripts, each measured with the change on and off on the same page. First, the script text: when the page goes idle, every script text nothing is reading is compressed with Floati's own compressor (the same one its PDF writer uses), on a background thread so the page never waits, and unpacked again on the rare occasion something needs it. Second, parameter lists: minified code names parameters e, t, n over and over, and each of a large page's 27,000 functions kept two private copies of its list; now every list is stored once. Third, compiler bookkeeping: every function carried about 100 bytes of empty slots for the fast compilers, and most functions on a page are never called, so those slots are now made on a function's first call.
What comes next: compile only what runs
Floati compiles every function of a script when the script loads, and keeps the result. Measured on a phone company's page, 71 percent of that compiled code belongs to functions that never run. Leading engines compile a function only when it is first called; Floati now can too, and this release ships the parts it needs: calls between separately compiled code, a parser that skims a function body it will not need yet, and every compiler tier working on such functions. It is switched off for now because it is not yet free: on script-heavy pages it saves about 4 percent of memory but costs about 6 percent of script time. Floati only turns on what costs nothing, so the remaining cost comes first.