erkamyaman/rust-anything

Starting from 3.3.0, the bridge no longer rejects PHP: top-level functions with parameters that are scalars, strings, lists, or associative arrays generate a Rust library and a PHP wrapper of the same name, called via ext-ffi; static methods in public C# classes generate P/Invoke wrappers, and record, diff, and bench all work. The author tested it with one source file each from PEAR XML_Util and Google.Protobuf; all recorded test cases passed comparison, but they were slower than the original language after going through the JSON bridge. 3.2.0 Fixed issues such as Python keyword arguments and incorrect recording of Buffers and typed arrays during JS recording; Go now skips functions that must remain in the original language and selects the next portable hotspot instead.

Starting from 3.3.0, the bridge no longer rejects PHP: top-level functions with parameters that are scalars, strings, lists, or associative arrays generate a Rust library and a PHP wrapper of the same name, called via ext-ffi; static methods in public C# classes generate P/Invoke wrappers, and record, diff, and bench all work. The author tested it with one source file each from PEAR XML_Util and Google.Protobuf; all recorded test cases passed comparison, but they were slower than the original language after going through the JSON bridge. 3.2.0 Fixed issues such as Python keyword arguments and incorrect recording of Buffers and typed arrays during JS recording; Go now skips functions that must remain in the original language and selects the next portable hotspot instead.

Why it matters Two more versions have been released since yesterday's inclusion: PHP top-level functions and C# public static methods can now connect to Rust implementations, and multiple issues with recording and comparison have been fixed.

Stars 8011 (+571 / 24h)

Reasons

  • 24 hours added 571 stars, total stars 8011 (only indicates attention level); MIT license
  • The changelog explicitly notes unfavorable results: each function in XML_Util is slower than PHP after bridging, and for the batch of small C# functions taking tens of nanoseconds, the call overhead far exceeds the function itself

Usage

  • After running cargo install rust-anything, first run rust-anything analyze in a PHP or C# project to see which units can be ported, then use bridge to generate bridges, record to capture test cases, and diff and bench for comparison and speed testing

Risks

  • PHP static methods, classes, references, and variadic arguments, as well as C# generics, ref/out, overloads, and async methods still remain in the original language; shadow and --batch do not support these two languages
  • Cross-language calls have fixed overhead; very small functions may become slower after porting, so rely on bench results; record, diff, and bench actually run the original program, so they should be executed in a test environment

Open

GitHub

Explore the latest AI Radar updates