rust-anything 2.0.0 → 2.0.1
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
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
<a href="docs/faq.md#faq">FAQ</a>
|
|
25
25
|
</p>
|
|
26
26
|
|
|
27
|
-
<p align="center">Made in Türkiye 🇹🇷 by <a href="https://github.com/erkamyaman">erKam Yaman</a> · <a href="LICENSE">MIT</a></p>
|
|
27
|
+
<p align="center">Made in Türkiye 🇹🇷 by <a href="https://github.com/erkamyaman">erKam Yaman</a> · <a href="LICENSE">MIT</a> · <a href="https://github.com/sponsors/erkamyaman">❤️ Sponsor me</a></p>
|
|
28
28
|
|
|
29
29
|
<p align="center">Sponsored by <a href="https://coderabbit.ai"><img src="docs/assets/brands/coderabbit.png" width="22" height="22" align="absmiddle" alt=""> <b>CodeRabbit</b></a></p>
|
|
30
30
|
|
|
@@ -73,6 +73,18 @@ recorded HTTP cases match on a pure Rust binary. Measured on an Apple M4, two ru
|
|
|
73
73
|
output compared before timing ([details](docs/real-world.md)). Calling Rust once per small
|
|
74
74
|
function is usually *slower* than a JIT; rust-anything finds the loop worth moving, and moves it.
|
|
75
75
|
|
|
76
|
+
<p align="center">
|
|
77
|
+
<img src="docs/assets/prettier.gif" alt="Prettier and its Rust port format the same 59 real files, one process per file: Prettier takes 3.63 s, the Rust port 0.20 s, with the same output byte for byte." width="820">
|
|
78
|
+
<br>
|
|
79
|
+
<sub>Prettier against its Rust port on 59 real files from ms, Fuse.js and json-server (Apple M4). Same output, byte for byte. <a href="docs/real-world.md#prettier">How it was measured</a>.</sub>
|
|
80
|
+
</p>
|
|
81
|
+
|
|
82
|
+
<p align="center">
|
|
83
|
+
<img src="docs/assets/json-server.gif" alt="json-server as a Node server and as one Rust binary: memory at idle 74 MB and 3.5 MB, start to first response 79 to 85 ms and 8 to 10 ms, and 514 of 514 recorded HTTP cases match." width="820">
|
|
84
|
+
<br>
|
|
85
|
+
<sub>json-server, a whole Node server, lifted to a pure Rust binary (Apple M4). <a href="docs/real-world.md#json-server">How it was measured</a>.</sub>
|
|
86
|
+
</p>
|
|
87
|
+
|
|
76
88
|
> rust-anything is an independent project, not affiliated with or endorsed by the Rust Project
|
|
77
89
|
> or the Rust Foundation. "Rust" is a trademark of the Rust Foundation.
|
|
78
90
|
|
|
@@ -148,12 +160,6 @@ the whole argv) and copy [`skills/rust-anything/`](./skills/rust-anything) to
|
|
|
148
160
|
|
|
149
161
|
Or run the steps yourself:
|
|
150
162
|
|
|
151
|
-
<p align="center">
|
|
152
|
-
<img src="docs/assets/terminal.gif" alt="rust-anything profile finds fuzzyScore in a loop, bridge --batch generates the Rust crate, gate passes with 2000/2000 recorded cases, and the benchmark shows 20.7x faster than TS." width="820">
|
|
153
|
-
<br>
|
|
154
|
-
<sub>The steps on x18n's <code>fuzzyScore</code>: <code>profile</code> finds the hot loop, <code>bridge --batch</code> generates the crate, <code>gate</code> passes, and the benchmark compares it with the TypeScript.</sub>
|
|
155
|
-
</p>
|
|
156
|
-
|
|
157
163
|
```sh
|
|
158
164
|
rust-anything profile . -- node bench.mjs # what is hot, and who calls it
|
|
159
165
|
rust-anything bridge . src/fuzzy.ts --batch fuzzyScore:text
|
|
@@ -170,6 +176,14 @@ first and in which order, a bridge so the rest of the code calls the Rust with i
|
|
|
170
176
|
the exact behavior the port must match, a safe way to ship it, and a gate that says when a port is
|
|
171
177
|
done.
|
|
172
178
|
|
|
179
|
+
Same output is not enough. Record what the app sends too, and a rewrite that mails twice fails:
|
|
180
|
+
|
|
181
|
+
<p align="center">
|
|
182
|
+
<img src="docs/assets/effects.gif" alt="app record with --effects smtp records one welcome email per signup; app replay of a rewrite that prints the same output but mails twice reports 0/2 cases passed, failing on effects, and the report shows the extra email." width="820">
|
|
183
|
+
<br>
|
|
184
|
+
<sub>A real run of <code>app record --effects</code> and <code>app replay</code>. See <a href="docs/whole-apps.md#side-effects-email-webhooks-and-databases">Side effects</a>.</sub>
|
|
185
|
+
</p>
|
|
186
|
+
|
|
173
187
|
## Languages
|
|
174
188
|
|
|
175
189
|
| Language | Unit | Bridge | Recorded and replayed by |
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rust-anything",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "Rewrite your app in Rust, one piece at a time, checked against the original's recorded behavior at every step. TypeScript, Python, C, Go, Ruby, Java.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"rust",
|