{"slug": "mountaingraph-profiling-data-drawn-as-3d-landscapes", "title": "MountainGraph: Profiling data drawn as 3D landscapes", "summary": "Developer pcdv published MountainGraph, a static progressive web app that renders profiling data as 3D landscapes, at pcdv.github.io/mountain-graph. MountainGraph reads and writes Flamepack (`fpk`) files containing wall time, allocations, or data extracted from Java heap dumps, and parses Java Flight Recorder (JFR) and HPROF profiles plus `stackcollapse` and `cpuprofile` formats, offering 2D, 3D, and flame graph viewing modes, anonymization, a guided tour, fly-through mode, and Minecraft-style landscapes. The app is a companion to the author's jfr-web Java profiler and jheap HPROF parser, which can compress a 5 GiB heap dump to roughly 1 MiB by keeping only aggregated paths; the author said the project was built during recovery from a small injury with help from an idle Claude subscription.", "body_md": "A progressive web app (PWA) that draws profiling data as 3D landscapes. You can browse the included gallery if you have no files to open. It works on a smartphone, but a computer gives the best experience.\n\nThe app embeds its own documentation.\n\nThis is an experiment I had in mind for years: exploring profiling data graphically, like a flame graph, but in three dimensions. I lacked the time, motivation or 3D skills to see it through.\n\nA small injury left me stuck on a couch for some time, and an idle Claude subscription did the rest.\n\nMountainGraph reads and writes Flamepack files (`fpk`), an open format described\n[here](https://github.com/pcdv/flamepack). Those files can contain:\n\n- time spent (wall time)\n- allocations\n- data extracted from a Java heap dump (classes or duplicated strings)\n\nIt can parse several file types, mainly Java profiles (JFR, HPROF) but also:\n\n- `stackcollapse`\n- `cpuprofile` ([conversion](https://github.com/pcdv/flamepack/blob/master/tools/cpuprofile.mjs) is needed first)\n\nMore formats could be added if needed.\n\nNon-exhaustive feature list:\n\n- Viewing modes: 2D, 3D, Flame graph\n- Anonymization\n- Tour (guided slide show)\n- Fly-through mode\n- Minecraft-style landscapes\n\nIt is a companion app to other tools I wrote:\n\n- [jfr-web](https://github.com/pcdv/jfr-web) : a Java profiler based on JFR (CLI and web app),\nworking in several modes: standalone, embedded, static HTML. It adds the notion of an*operation* (e.g. HTTP request, RPC call, JUnit test) and many ways to inspect them. It supports[flak](https://github.com/pcdv/flak) applications out of the box.\n- [jheap](https://github.com/pcdv/jheap) : parses HPROF files and outputs a Flamepack file.\nIt can (lossily) \"compress\" a 5 GiB heap dump in around 1 MiB by keeping only the aggregated paths.\nThe resulting file can be opened in MountainGraph, or further analyzed by`jheap` itself. I wrote a\nsmall agent skill that uses`jheap` to quickly find the source of a memory leak.\n\nA flame graph shows where the time went, but it can only be read in one order at a time. Top-down, it ranks the most expensive stacks. Inverted, it ranks the hot methods and spreads their callers beneath them. MountainGraph is an experiment in using a third dimension to show both at once.\n\nIt draws a profile as a landscape. The methods that take the most time rise as peaks (the inverted\nview), and the call paths into them form the slopes (the stacks of the top-down view), down to the\nentry points, a request or a thread, at the foot. The question it asks is not only *where?* but\n*why do we keep ending up here?*\n\nA heap dump reads the same way. The objects holding the most memory are the peaks, and the references that lead to them are the slopes, out to the roots that hold everything up.\n\nIt is one static page, with no build step and no server. Drop a file on it and it works out what the file is. A topographic map comes first, then the same terrain in 3D.\n\nThe TypeScript compiler type-checking a React front end. One peak is `stat`, the time spent in the\nfile system, and the flame graph of the whole profile stands behind the land.\n\nAnother view on a Java application's unit tests. Each island is a hot\nspot. Two of them are real findings: `CustomTemporaryFolder` was a high source of latency in the\ntest run, and `CPUMemExtractor` called an expensive Windows counter, until it was optimized away.\n\nThe allocations of a Gradle daemon. The peak, `char[]`, is 5.8 GiB, 97% of it from jgitver working\nout the version from the git tags.\n\nThe same daemon in time, with the waits left out, which would otherwise be the highest peaks. The\nmesa is the compile, and the island labelled `1005078208.test` is jgitver's tag filter again, 2.3\nseconds of the worker's time.\n\nThe page works on a phone. Here is the TypeScript compiler again, the land in blocks: one finger turns it, and two fingers pinch to zoom.\n\nThe page is published at [https://pcdv.github.io/mountain-graph/](https://pcdv.github.io/mountain-graph/), with a few profiles to open from\nits landing page. A file is read in the browser and goes nowhere else.\n\nThe page installs as an app, from the browser's menu (\"Install\" or \"Add to Home screen\"). Installed,\nit opens with no network, as it was when last seen online. On a desktop, the system then offers it to\nopen `.jfr`, `.fpk`, `.hprof` and the other files it reads. An installed page still updates itself:\nit is fetched from the network first whenever there is one.\n\nTo run it locally, Node 21 or later, with nothing to install:\n\n```\nnpm run serve   # http://localhost:8091/ (browsers refuse modules opened from file://)\nnpm test        # the tests of the modules without DOM\n```\n\nTo open it from a phone on the same network, serve it on every interface. It prints the addresses\nto browse to, for example `http://192.168.1.20:8091/`:\n\n```\nnpm run serve -- 8091 0.0.0.0   # port, then host\n```\n\nPick a file or drop it on the page, gzipped or not: the page tells what it is from its first bytes. First, samples, of time or of allocations:\n\n- **JFR recordings** (`.jfr` , JDK 11 and later), read in the page. A recording holds two kinds of\nsamples, which weigh different things, so both are read, and a*Samples* choice in the top bar\nswitches between the wall clock (Java and native samples, weighing time) and the allocations\n(weighing bytes). A recording read this way has no operations.\n- **[Flamepack](https://github.com/pcdv/flamepack)** (`.fpk` , version 5, 4 or 3): collapsed stacks\npacked with a string dictionary, each sample enriched with its time, thread and operation.[jfr-web](https://github.com/pcdv/jfr-web) writes it from its recordings, time or allocations\n(`GET /api/sessions/:id/profile` ; a static export,`jfr-web export <file.jfr> -o <dir>` , holds one\nper recording under`data/` , with`static.json` mapping`api/sessions/<id>/profile` to its file).\njheap writes it from a heap dump (below), and any other tool can.\n- **Collapsed stacks** , the text format of[FlameGraph](https://github.com/brendangregg/FlameGraph) 's`stackcollapse` scripts (`a;b;c 12` per line), which any profiler can produce. Their counts are\nsamples, with no time, thread or operation.\n\nWhatever the samples were read from, the file's menu saves those shown as a Flamepack, with **Save**.\nIt saves **All data** at first, the whole profile as a `.fpk`, gzipped unless that is unchecked, under\na name that can be changed. A loss drops the\nstacks of the methods that hardly run, where the flame graph is thin, cutting each at its deepest\ncaller wide enough and ending it in `(thin stacks)`. The file comes out half or a third the size.\nEvery sample keeps its time, thread and weight, and the methods that take time keep their peaks; the\ntotal of a method is short by the thin stacks it is on.\n\nThe file keeps the waits, the native samples and the hidden frames, and the settings apply again\nwhen it is opened. **Only what is shown**, with a loss, saves what the view shows instead: the\nsamples left out as waits, the native ones when only Java's are shown, and those outside the\ninterval or the operation in focus are not in the file, and the frames hidden are out of its stacks,\ntheir time with their callers. The file is smaller, and draws as the view drew it.\n\n**With the settings of the view** adds to either file how the page is set: the view, the shape of the\nland, the peaks counted, the camera. Whoever opens the file sees what was shown. The anonymizing\nrules and personal habits (the mouse, the width of the panels) are never in it.\n\nA **tour** walks someone through a profile: views of it, each with a caption, shown one after the\nother. `T` adds the view shown, as it is set, with the camera, the interval and the operation in focus,\nthe frame hovered with the box telling its path, and the Peaks pane open or folded. The Tour section\nof the settings puts the views in order, gives them their captions and sets how long each stays, and\n`P` plays them, on their own or step by step. Between two 3D views that differ only by the camera, it flies. **With the tour**, on when\nthere is one, keeps it in the file, which plays it when opened.\n\nThen the memory of a JVM:\n\n- **Heap dumps** (`.hprof` , as jmap and jcmd write them), parsed in the page by[jheap](https://github.com/pcdv/jheap) 's parser compiled to WebAssembly, in a Web Worker that\nreads the file a slice at a time. A dump of 4.6 GB and 46 million objects opens in under 20\nseconds, and the page stays responsive throughout. WebAssembly addresses 4 GiB, so the page reads\nheaps up to roughly 100 million objects. Beyond that, or for a gzipped dump, the`jheap` command\nparses it and keeps the result beside it,`<name>.jheap.fpk` , a Flamepack the page opens as it\nwould the dump. So does a heap the page saved,`<name>.fpk` . The file's menu also saves with a\nloss: the heap reduced to what the page draws, for a gallery or a report, in a`<name>-reduced.fpk.gz` a few percent of the dump's profile, at a level of loss that is chosen,\nits size said before the file is saved (`tools/reduce.js` does the same from a terminal).\n- **Duplicate Strings** , from`jheap <dump> dups --save <name>.fpk` : a peak is a value held in\nseveral copies, as high as what keeping one copy would save, and its slopes are the objects that\nhold the copies, out to the root. The page recognises the file by its`duplicates` member and\ndraws it as*Own size* with the class alone, so the settings that choose how peaks are ranked and\ngathered are not shown. The file holds the Strings' text, the application's data, as a heap dump\ndoes, so it is no more shareable than the dump.\n\nA heap's peaks are ranked by what they hold, as the deepest chain of holders that still retains\nmost of the weight. Clicking one opens a panel with what it **holds** and who it is **held by**.\nEvery name there is clickable and shows that object instead, so a map can be followed out to the\ncache holding it and in to its entries. The page draws a heap approximately, in two ways, as\njheap's command does:\n\n- **The holder tree is a breadth-first spanning tree, not a dominator tree.** Totals are exact,\nbut an object held by several others shows only one of them, whichever the walk reached it from\nfirst.\n- **Thin wrappers are skipped by heuristic.** An object that owns under 1% of what it holds and\nspreads it over several children is taken for the place where the walk entered the graph, not for\nan owner. The setting*thin wrappers* shows them again.\n\nThe last file opened is kept in the browser and shown again when the page is reloaded. A heap dump is kept as its parse, a few MB, so a reload does not parse it again.\n\nProfiles tried locally go in `samples/`, which git ignores. `test/fixtures/` holds a small real\nrecording, with the program it was made from.\n\n`web/js/profile/profile.js` is a copy of jfr-web's, kept identical: a change to it is made in\njfr-web. `web/js/hprof/jheap.wasm` is built in [jheap](https://github.com/pcdv/jheap), whose\n`node crates/jheap-wasm/install.mjs` copies it here; the parse tests run it. `dom.js`, `dialog.js`\nand `settings.js` in `web/js/lib/` are copied from [web-lib](https://github.com/pcdv/web-lib)\n(`web-lib.json` there tells which), with a `.d.ts` beside each: they are fixed in web-lib, then\nsynced.", "url": "https://wpnews.pro/news/mountaingraph-profiling-data-drawn-as-3d-landscapes", "canonical_source": "https://github.com/pcdv/mountain-graph", "published_at": "2026-11-24 22:36:43+00:00", "updated_at": "2026-11-24 22:44:43.296541+00:00", "lang": "en", "topics": ["developer-tools", "ai-tools"], "entities": ["MountainGraph", "pcdv", "Flamepack", "jfr-web", "jheap", "Java Flight Recorder", "HPROF", "Claude"], "also_reported_by": [], "takeaway": "MountainGraph renders Flamepack (`fpk`) profiles as 3D landscapes that combine the inverted hot-method view as peaks with top-down call stacks as slopes, and jheap can shrink a 5 GiB HPROF heap dump to about 1 MiB by keeping only aggregated paths.", "recommendation": null, "alternates": {"html": "https://wpnews.pro/news/mountaingraph-profiling-data-drawn-as-3d-landscapes", "markdown": "https://wpnews.pro/news/mountaingraph-profiling-data-drawn-as-3d-landscapes.md", "text": "https://wpnews.pro/news/mountaingraph-profiling-data-drawn-as-3d-landscapes.txt", "jsonld": "https://wpnews.pro/news/mountaingraph-profiling-data-drawn-as-3d-landscapes.jsonld"}}