|
smollerGraph 0.20.2
A small graph database, from scratch
|
Accepted
Episode 10 loaded the mammals and birds from Wikidata, 21,834 taxa. The page from episode 4 (0010) asked sg serve for the whole graph, about 2.4 million bytes of JSON, and drew each node and relationship as an SVG element, which D3's layout moved on each tick: a tangle of lines, at a few frames a second.
kMaxDrawn in api.h), with the relationships between them, where Neo4j Browser draws up to 300 by default. The rows go in a table, up to 1,000 (kMaxRows). QueryJson also says how long the query took on the server and how many pages it read, which a status line shows. GraphJson and WalkJson and their routes are gone.ui/view.js draws on a canvas, "one element that the page paints pixels on", in place of an SVG element for each circle and line: a path for the relationships, one for their arrowheads, and one for each label's nodes, in a colour for each label, each painted with one call however many shapes it holds. Names are written while there are 150 nodes or fewer, or once the view is zoomed in far enough to read them. D3's force simulation still places the nodes.index.html, page.css and app.js: a query box with a history, Graph, Table and Plan tabs, a search for a node by its name, and the inspector, whose button, or a double-click, draws a node's neighbours.ui/bench.html and bench/ui.py (ep010/step-5) count the frames Chromium paints in three seconds while the page's layout moves a made-up graph, drawn with SVG, on a canvas, or not at all. On the run episode 10 recorded, on an Apple M4 Pro, in frames a second:| Nodes | Not drawn | Canvas | SVG |
|---|---|---|---|
| 500 | 59.8 | 59.8 | 59.8 |
| 1,000 | 60.0 | 59.8 | 59.7 |
| 2,000 | 60.0 | 59.7 | 59.8 |
| 5,000 | 59.2 | 59.2 | 23.5 |
| 10,000 | 29.9 | 27.6 | 11.0 |
| 20,000 | 13.5 | 11.9 | 4.9 |
find, on a press or a click.bench/ui.py opens a window.