@grafema/rfdb 0.2.3-beta → 0.2.5-beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # @grafema/rfdb
2
2
 
3
- > High-performance disk-backed graph database server for Grafema
3
+ > **RFDB** (Rega Flow Database) — high-performance disk-backed graph database server for Grafema
4
+
5
+ *Named after the author's wife Regina (Rega for short). The Hebrew word רגע (rega, "moment") conveniently fits the concept — a flow of discrete moments captured in the graph.*
4
6
 
5
7
  **Warning: This package is in early alpha stage and is not recommended for production use.**
6
8
 
@@ -29,11 +31,14 @@ cargo build --release
29
31
  ### As a CLI
30
32
 
31
33
  ```bash
32
- # Start the server
33
- npx rfdb-server --socket /tmp/rfdb.sock --data-dir ./my-graph
34
+ # Start the server (db-path is required, socket is optional)
35
+ npx rfdb-server ./my-graph.rfdb --socket /tmp/rfdb.sock
34
36
 
35
37
  # Or if installed globally
36
- rfdb-server --socket /tmp/rfdb.sock --data-dir ./my-graph
38
+ rfdb-server ./my-graph.rfdb --socket /tmp/rfdb.sock
39
+
40
+ # Using default socket path (/tmp/rfdb.sock)
41
+ rfdb-server ./my-graph.rfdb
37
42
  ```
38
43
 
39
44
  ### Programmatic usage
@@ -66,7 +71,7 @@ server.kill();
66
71
 
67
72
  ## With Grafema
68
73
 
69
- RFDB is optional for Grafema. By default, Grafema uses an in-memory backend. To use RFDB for persistent storage:
74
+ RFDB (Rega Flow Database) is optional for Grafema. By default, Grafema uses an in-memory backend. To use RFDB for persistent storage:
70
75
 
71
76
  ```javascript
72
77
  const { Orchestrator, RFDBServerBackend } = require('@grafema/core');
@@ -102,9 +107,72 @@ cargo build --release
102
107
 
103
108
  # Run tests
104
109
  cargo test
110
+ ```
111
+
112
+ ## Performance Benchmarks
113
+
114
+ RFDB includes Criterion-based benchmarks covering all core graph operations.
115
+
116
+ ### Running Locally
117
+
118
+ ```bash
119
+ cd packages/rfdb-server
120
+
121
+ # Run all benchmarks
122
+ cargo bench --bench graph_operations
123
+
124
+ # Run specific benchmark group
125
+ cargo bench --bench graph_operations -- 'add_nodes'
126
+ cargo bench --bench graph_operations -- 'get_node'
127
+
128
+ # Save baseline for future comparison
129
+ cargo bench --bench graph_operations -- --save-baseline my-baseline
130
+
131
+ # Compare against saved baseline
132
+ cargo bench --bench graph_operations -- --baseline my-baseline
133
+ ```
134
+
135
+ ### Benchmark Coverage
136
+
137
+ | Category | Operations |
138
+ |----------|-----------|
139
+ | **Node write** | add_nodes |
140
+ | **Edge write** | add_edges |
141
+ | **Node read** | get_node, find_by_type, find_by_type (wildcard), find_by_attr |
142
+ | **Edge read** | get_outgoing_edges, get_incoming_edges, neighbors |
143
+ | **Mutation** | delete_node, delete_edge |
144
+ | **Traversal** | bfs, reachability (forward/backward) |
145
+ | **Maintenance** | flush, compact |
146
+
147
+ ### CI Regression Detection
148
+
149
+ Benchmarks run on PRs with the `benchmark` label (comparing PR vs main branch).
150
+ Regressions >20% will fail the workflow.
151
+
152
+ To trigger on your PR: add the `benchmark` label.
153
+
154
+ ### What to Do If Benchmarks Regress
155
+
156
+ If CI reports a regression on your PR:
157
+
158
+ 1. **Check if it's noise** — re-run the workflow. CI runners have variable load; spurious regressions happen.
159
+ 2. **Reproduce locally** — save baselines before/after your change and compare with `critcmp`:
160
+ ```bash
161
+ git stash && cargo bench --bench graph_operations -- --save-baseline before
162
+ git stash pop && cargo bench --bench graph_operations -- --save-baseline after
163
+ cargo install critcmp && critcmp before after
164
+ ```
165
+ 3. **Identify the cause** — look at which operations regressed. A regression in `add_nodes` suggests storage overhead; `bfs`/`reachability` point to traversal changes.
166
+ 4. **Fix or justify** — if the regression is real, fix it. If it's an acceptable trade-off (e.g., +15% write latency for 10x better reads), document the trade-off in the PR description.
167
+
168
+ ### Comparing Before/After Changes
169
+
170
+ ```bash
171
+ # Before making changes
172
+ cargo bench --bench graph_operations -- --save-baseline before
105
173
 
106
- # Run benchmarks
107
- cargo bench
174
+ # Make changes, then compare
175
+ cargo bench --bench graph_operations -- --baseline before
108
176
  ```
109
177
 
110
178
  ## License
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@grafema/rfdb",
3
- "version": "0.2.3-beta",
4
- "description": "High-performance disk-backed graph database server for Grafema",
3
+ "version": "0.2.5-beta",
4
+ "description": "RFDB (Rega Flow Database) — high-performance disk-backed graph database server for Grafema",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
7
7
  "bin": {
@@ -9,14 +9,17 @@
9
9
  },
10
10
  "repository": {
11
11
  "type": "git",
12
- "url": "https://github.com/Disentinel/rfdb.git"
12
+ "url": "https://github.com/Disentinel/grafema.git",
13
+ "directory": "packages/rfdb-server"
13
14
  },
14
15
  "keywords": [
15
16
  "graph",
16
17
  "database",
17
18
  "semantic-analysis",
18
19
  "code-analysis",
19
- "rust"
20
+ "rust",
21
+ "rega-flow",
22
+ "rfdb"
20
23
  ],
21
24
  "author": "Vadim Reshetnikov",
22
25
  "license": "Apache-2.0",
Binary file
Binary file
Binary file