Working with data

By this point you have seen Ring draw a page and drive a clock. The natural next question is the one every application eventually asks: can it carry a normal data load? Here is a working answer — an app holding twenty thousand records inside the Ring VM, in your browser, that you can filter, sort, total and add to.

The app: a savings-circle register

Members of a savings circle put money into numbered rounds — a shape of data any business application will recognise: records with an id, a name, a number, an amount and a status. The page loads them once into the resident VM, and from then on every control calls a Ring function. Filtering as you type, sorting on a header click, validating a form, recomputing totals — all of it runs in Ring, on data that never leaves the VM. Only the answer crosses back.

Measured the way a user feels it

A page is not fast or slow in the abstract — it is fast or slow against how people perceive delay. So every interaction in the app is measured live, against three familiar thresholds:

And because a fast wrong answer is worthless, every result is also recomputed independently in JavaScript and compared, live, with a check mark you can watch. Correctness first, then speed.

The numbers

Interaction20,000 records50,000 records
Draw a page of 25 rows0.2 ms0.4 ms
Recompute the totals11 ms28 ms
Filter, on every keystroke15 ms38 ms
Sort a column53 ms130 ms
Rebuild the leaderboard92 ms238 ms
Load, once at startup106 ms879 ms

At twenty thousand records — a generous size for anything a person actually scrolls through — everything the user touches is instant or responsive. At fifty thousand, two interactions become noticeable, and the app labels them as such rather than hiding it.

What building it taught us

Driving this app at full size sharpened the runtime itself and produced a short set of rules for writing fast data pages in Ring — the payload shape that loads fifteen times faster, the loop forms that avoid hidden copies, and more. They are written up where they are most useful:

And what an application built this way looks like

The register above is a data page. Route Orders is the next question answered: a whole business application — a field-sales order pad — with the price tiers, the discounts, the tax, the stock check and the credit limit all running in Ring on the device, and the server used exactly twice. It has a switch marked Cut the connection, and the article carries the two HTTP endpoints in full so the pattern can be built against a back end in any language.