Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,12 @@ next-env.d.ts

# Monaco editor (auto-generated from node_modules during build)
/public/monaco-editor/

# Nix build output
/result

# Local Jupyter state
/.jupyter/
/.jupyter_ystore.db*
.ipynb_checkpoints/
__pycache__/
6 changes: 6 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ Brows3 is built for speed. Every contribution should preserve performance as a f

Brows3 is a **Tauri v2** application with a **Next.js** frontend and a **Rust** backend.

### Building with Nix on x86-64 Linux

From the repository root, `nix build` creates `result/bin/brows3` with the static frontend embedded. `nix run` opens the desktop app. Enable the Nix `nix-command` and `flakes` features to use these commands.

For development, run `nix develop`, then `pnpm install --frozen-lockfile` and `pnpm tauri dev`. The shell supplies the CI Rust and pnpm versions, Node.js 22, and the GTK and WebKit development libraries. Run `nix flake check` to build the desktop app and run the native and frontend package checks.

### Prerequisites

- **Node.js** 22 and **pnpm** 11.2.2
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ Traditional S3 tools often suffer from latency when navigating deep folder struc
- **Presigned URL Sharing**: Generate temporary object links with configurable expiry directly from the bucket view.
- **Object Permissions**: View and apply S3 object ACLs for files and recursively for folder prefixes, with clear messages when a bucket or provider has ACLs disabled or unsupported.

### Client-side encrypted buckets

Choose **Yes, create** in the bucket creation dialog to create a protected bucket with a private display name and passphrase. Unlock the bucket to list folders, upload an encrypted file, or authenticate and download a file to a new local destination. Each file can be up to 1 GiB. The storage provider can see object names and sizes.

Keep the passphrase and the bucket’s `.brows3/key-v1` object. Brows3 needs both to recover the file-encryption key. Sessions expire after 15 minutes and can also be locked manually. The [profiling notebook](docs/benchmarks/encryption-before-wire.ipynb) measures preparation from encryption entry to the signed PUT handoff.

### Rich Previews & Editing
- **Built-in Editor**: Powered by **Monaco (VS Code's Engine)**. Edit text, JSON, and code files directly in S3.
- **Direct Edit Action**: Quick "Edit" button in the file list and context menu for instant code/text modifications.
Expand Down
120 changes: 120 additions & 0 deletions docs/TRANSFER_PROFILING.md

Large diffs are not rendered by default.

Binary file added docs/benchmarks/cpu-profile/4kib-encrypted.pb.gz
Binary file not shown.
Binary file added docs/benchmarks/cpu-profile/4kib-encrypted.prof
Binary file not shown.
Binary file not shown.
Binary file added docs/benchmarks/cpu-profile/4kib-plain.pb.gz
Binary file not shown.
Binary file added docs/benchmarks/cpu-profile/4kib-plain.prof
Binary file not shown.
Binary file added docs/benchmarks/cpu-profile/4kib-plain.stacks.gz
Binary file not shown.
Binary file added docs/benchmarks/cpu-profile/8mib-encrypted.pb.gz
Binary file not shown.
Binary file added docs/benchmarks/cpu-profile/8mib-encrypted.prof
Binary file not shown.
Binary file not shown.
Binary file added docs/benchmarks/cpu-profile/8mib-plain.pb.gz
Binary file not shown.
Binary file added docs/benchmarks/cpu-profile/8mib-plain.prof
Binary file not shown.
Binary file added docs/benchmarks/cpu-profile/8mib-plain.stacks.gz
Binary file not shown.
12 changes: 12 additions & 0 deletions docs/benchmarks/cpu-profile/capture.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
running 1 test
test commands::encrypted::encryption_timing::raw_cpu::capture_cpu_before_wire ... PROFILE: interrupts/evictions/bytes = 734/56/115768
BROWS3_CPU 4kib plain 76026 iterations
PROFILE: interrupts/evictions/bytes = 709/110/81848
BROWS3_CPU 4kib encrypted 51368 iterations
PROFILE: interrupts/evictions/bytes = 700/82/115976
BROWS3_CPU 8mib plain 78814 iterations
PROFILE: interrupts/evictions/bytes = 750/491/54520
BROWS3_CPU 8mib encrypted 530 iterations
ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 171 filtered out; finished in 13.61s
5 changes: 5 additions & 0 deletions docs/benchmarks/cpu-profile/conditions.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
2026-11-25T02:29:12Z
rustc 1.97.1 (8bab26f4f 2026-07-14)
32435ea3d8322e1e56051b37c3c491fa75ef6cc2
Linux 7.2.7+rex-amd64 x86_64
500 Hz requested, 3 seconds accumulated pre-transmit wall time per profile
124 changes: 124 additions & 0 deletions docs/benchmarks/encryption-7a74b6b.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
{
"commit": "7a74b6b932f0e5dfda868a8b2f3e733141c6b662",
"build": "cargo test --locked --release, repository release flags",
"rust": "1.97.1",
"aws_sdk_s3": "1.121.0",
"libsodium_sys_stable": "1.24.6",
"os": "Ubuntu 22.04 x86_64 userspace on Linux",
"kernel": "7.2.7+rex-amd64",
"cpu": "AMD Ryzen AI Max+ 395",
"filesystem": "Btrfs, warm source file and local anonymous ciphertext file",
"observed_at": "2026-11-25T02:02:46.783257+00:00",
"host_load": "Shared host. A Nix build was active during the measurement.",
"start": "Immediately before encrypt_object (plain control: entry to ordinary upload_file)",
"end": "AWS SDK read_before_transmit for a signed PutObject, before dispatch to HTTP",
"method": "One excluded warm-up per size and mode, 21 measurements per mode in alternating order. No request transmitted. p95 is nearest rank.",
"results": [
{
"bytes": 4096,
"plain_samples_ns": [
64150,
71925,
71324,
84869,
93765,
88856,
61475,
65843,
60283,
53971,
43221,
43521,
41809,
42269,
42179,
44183,
41287,
42279,
41899,
42419,
40797
],
"samples_ns": [
94296,
89408,
128982,
116197,
116067,
106269,
76933,
74950,
115636,
100158,
67726,
65944,
64952,
64671,
64571,
63829,
64621,
64641,
69480,
63409,
65392
],
"encrypted_median_ms": 0.06948,
"encrypted_p95_ms": 0.116197,
"plain_median_ms": 0.044183,
"plain_p95_ms": 0.088856
},
{
"bytes": 8388608,
"plain_samples_ns": [
66955,
140653,
77976,
117339,
84378,
141776,
93415,
146774,
109745,
91251,
61736,
72666,
49383,
85149,
61505,
71514,
46206,
87925,
60263,
78978,
47940
],
"samples_ns": [
7185434,
6842872,
7338049,
6793651,
7698203,
6885702,
7291161,
7438717,
7069386,
6737135,
6742615,
6706187,
6709603,
6725413,
6723980,
6691078,
6733167,
6734469,
6780717,
6761600,
6734600
],
"encrypted_median_ms": 6.7616,
"encrypted_p95_ms": 7.438717,
"plain_median_ms": 0.078978,
"plain_p95_ms": 0.141776
}
]
}
323 changes: 323 additions & 0 deletions docs/benchmarks/encryption-before-wire.ipynb

Large diffs are not rendered by default.

180 changes: 180 additions & 0 deletions docs/benchmarks/encryption_profile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
"""Collect paired release timings and plot them at the SDK's pre-transmit boundary."""

import json
import math
import subprocess
from collections import Counter, deque
from itertools import groupby
from statistics import median
from time import monotonic

import matplotlib.pyplot as plt


WORKLOADS = {4096: ("4 KiB", "µs", 1_000), 8 * 1024**2: ("8 MiB", "ms", 1_000_000)}
MODES = (("plain_samples_ns", "Plain", "#216681"), ("samples_ns", "Encrypted", "#A84024"))
MARKER = "BROWS3_ENCRYPTION_NS "


def checked_results(rows):
by_size = {}
for row in rows:
size = row["bytes"]
if size in by_size:
raise ValueError(f"Duplicate timing record for {size} bytes")
for key, mode, _ in MODES:
values = row[key]
if len(values) != 21 or any(type(n) is not int or n <= 0 for n in values):
raise ValueError(f"Expected 21 positive nanosecond samples for {size} bytes, {mode}")
by_size[size] = row
if by_size.keys() != WORKLOADS.keys():
raise ValueError(f"Expected payload sizes {list(WORKLOADS)}, got {list(by_size)}")
return by_size


def fresh_results(root):
command = [
"cargo", "test", "--manifest-path", "src-tauri/Cargo.toml", "--locked", "--release",
"--lib", "profile_encryption_before_wire", "--", "--ignored", "--nocapture",
"--test-threads=1",
]
print("Running the release benchmark. The first build can take several minutes.", flush=True)
records, tail = [], deque(maxlen=18)
start = last_update = monotonic()
with subprocess.Popen(command, cwd=root, stdout=subprocess.PIPE,
stderr=subprocess.STDOUT, text=True) as process:
for line in process.stdout:
tail.append(line.rstrip())
if MARKER in line:
records.append(json.loads(line.split(MARKER, 1)[1]))
elif monotonic() - last_update >= 15:
print(f"{monotonic() - start:.0f}s {line.strip()}", flush=True)
last_update = monotonic()
if process.wait():
raise RuntimeError("Cargo benchmark failed.\n" + "\n".join(tail))
return checked_results(records)


def nearest_rank_p95(values):
return sorted(values)[math.ceil(0.95 * len(values)) - 1]


def paired_figure(runs):
fig, axes = plt.subplots(len(runs), len(WORKLOADS), squeeze=False, sharey="col",
figsize=(9, 0.8 + 3.4 * len(runs)), layout="constrained")
for row, (run_name, records) in enumerate(runs.items()):
for col, (size, (label, unit, divisor)) in enumerate(WORKLOADS.items()):
ax = axes[row, col]
data = records[size]
plain, encrypted = ([n / divisor for n in data[key]] for key, _, _ in MODES)
for left, right in zip(plain, encrypted):
ax.plot([0, 1], [left, right], color="#C3CDD1", linewidth=0.85, zorder=1)
for x, (points, (_, _, color)) in enumerate(zip([plain, encrypted], MODES)):
center = median(points)
ax.scatter([x] * len(points), points, s=26, c=color, alpha=0.55,
edgecolors="white", linewidths=0.4, zorder=2)
ax.scatter(x, center, marker="D", s=78, c=color, edgecolors="white", zorder=3)
ax.annotate(f"{center:.3g} {unit}", (x, center),
xytext=(-9 if x == 0 else 9, 0), textcoords="offset points",
ha="right" if x == 0 else "left", va="center",
color=color, fontsize=10, fontweight="bold")
ax.set(title=f"{run_name} · {label}", ylabel=f"Time before transmit ({unit})",
xticks=[0, 1], xticklabels=["Plain", "Encrypted"], xlim=(-0.48, 1.48))
ax.set_ylim(bottom=0)
ax.set_axisbelow(True)
ax.grid(axis="y", color="#DFE5E8", linewidth=0.8)
ax.spines[["top", "right", "left"]].set_visible(False)
ax.spines["bottom"].set_color("#ABB7BC")
ax.tick_params(length=0, pad=5)
return fig


def read_cpu_stacks(path):
"""Read pprof's weighted, leaf-first stack listing from a capture."""
import gzip
import re

with gzip.open(path, "rt") as stream:
blocks = re.split(r"^-+\+-+$", stream.read(), flags=re.MULTILINE)
stacks = []
for block in blocks[1:]:
lines = block.strip().splitlines()
if not lines:
continue
count, leaf = lines[0].split(maxsplit=1)
frames = [leaf, *(line.strip() for line in lines[1:])]
stacks.append((int(count), tuple(frame.removesuffix(" (inline)") for frame in frames)))
if not stacks or any(n <= 0 for n, _ in stacks):
raise ValueError(f"Expected positive CPU sample counts in {path}")
return stacks


def collect_cpu_profiles(directory):
return {(size, mode): read_cpu_stacks(directory / f"{size}-{mode}.stacks.gz")
for size in ("4kib", "8mib") for mode in ("plain", "encrypted")}


def short_symbol(symbol, limit=42):
name = symbol.replace("brows3_lib::", "").replace("::<>", "").replace("{closure#0}", "closure")
return name if len(name) <= limit else "…" + name[-(limit - 1):]


def cpu_hotspots(profiles):
fig, axes = plt.subplots(2, 2, figsize=(12, 6.8), layout="constrained", sharex=True)
colors = {"plain": "#236880", "encrypted": "#AA472A"}
for row, (size, label) in enumerate((("4kib", "4 KiB"), ("8mib", "8 MiB"))):
for col, mode in enumerate(colors):
ax = axes[row, col]
leaves = Counter()
for count, stack in profiles[size, mode]:
leaves[stack[0]] += count
total = leaves.total()
top = leaves.most_common(5)
for y, (name, count) in enumerate(top):
pct = 100 * count / total
ax.barh(y, pct, color=colors[mode], height=0.25, align="edge")
ax.text(0, y - 0.08, short_symbol(name, 53), fontsize=8.5, va="bottom")
ax.text(pct + 1.1, y + 0.12, f"{pct:.1f}%", fontsize=8, va="center")
ax.set(ylim=(len(top) - 0.42, -0.73), xlim=(0, 104), yticks=[],
xticks=[0, 25, 50, 75, 100])
ax.set_title(f"{label} · {mode.capitalize()} · {total:,} samples", loc="left",
fontsize=12, fontweight="bold", color=colors[mode])
ax.grid(axis="x", color="#DCE4E7", lw=0.65)
ax.set_axisbelow(True)
ax.spines[:].set_visible(False)
ax.tick_params(length=0, labelsize=8)
if row == 1:
ax.set_xlabel("Share of on-CPU samples (%)", fontsize=9)
return fig


def cpu_callers(stacks, title, levels=5):
"""Draw a leaf-first flame graph. Each nested block represents one caller."""
from matplotlib.patches import Rectangle

paths = Counter()
for count, stack in stacks:
paths[stack[:levels]] += count
total = paths.total()
colors = ("#164D65", "#1D6474", "#317D80", "#4D8C81", "#649384")
fig, ax = plt.subplots(figsize=(12, 3.25), layout="constrained")
ordered = sorted(paths.items())
for depth in range(levels):
x = 0
for prefix, entries in groupby(ordered, lambda pair: pair[0][:depth + 1]):
width = 100 * sum(count for _, count in entries) / total
if len(prefix) > depth:
ax.add_patch(Rectangle((x, depth - 0.435), width, 0.87, facecolor=colors[depth],
edgecolor="white", linewidth=0.55))
capacity = int(width * 1.45)
if capacity >= 8:
ax.text(x + width / 2, depth, short_symbol(prefix[-1], capacity),
ha="center", va="center", color="white", fontsize=8)
x += width
ax.set(xlim=(0, 100), ylim=(levels - 0.45, -0.54), yticks=list(range(levels)),
yticklabels=["Sampled function", *[f"Caller {i}" for i in range(1, levels)]],
xlabel="Share of on-CPU samples (%)")
ax.set_title(title, loc="left", fontsize=12, fontweight="bold")
ax.spines[:].set_visible(False)
ax.tick_params(length=0, labelsize=9)
return fig
Loading