r/ProWordPress • • 21h ago

New Rust tool Strauss-RS for prefixing classes and symbols in Wordpress plugins/themes, testers wanted

2 Upvotes

Note: Given mod permission to post about this.

We've been working on an open-source (MIT) tool that was initially built for ourselves, but since it's been such a pain point for us, we figured in might be helpful to the Wordpress developer community in general.

Strauss-RS is a Rust port of the Strauss project (itself a fork of Mozart) which prefixes classnames and symbols in Composer-based plugins and themes. Since plugins and themes are increasingly including their own dependencies, the chance of clashes has been increasing (we know, one client's site had a total meltdown when they installed Atum Pro because it used Eloquent).

With Strauss-RS, a class like `Illuminate\Support\String` would potentially become `Acme\PluginA\Vendor\Illuminate\Support\String` avoiding those clashes in your own code.

The main advantage of the Rust version is speed. We've also added a few more nice-to-have features. With Strauss PHP in our pipeline, prefixing could take several minutes every update or install, with the Rust version, it's down to a few seconds.

DM me if you'd like to give it a test run (direct links not allowed due to subreddit rules).

Project Workers Strauss PHP Strauss-RS Speedup PHP peak memory RS peak memory
small 1 625.4 ms 22.8 ms 27.4x 70 MiB 9.5 MiB
small 12 831.3 ms 9.1 ms 91.0x 411 MiB 11.7 MiB
medium 1 1.11 s 46.5 ms 24.0x 83 MiB 13.1 MiB
medium 12 1.38 s 16.2 ms 85.5x 599 MiB 19.5 MiB
large 1 18.72 s 761.3 ms 24.6x 259 MiB 81.6 MiB
large 12 16.84 s 188.7 ms 89.3x 1,291 MiB 97.7 MiB
xlarge 1 42.26 s 1.50 s 28.2x 990 MiB 336.2 MiB
xlarge 12 55.05 s 395.6 ms 139.1x 5,556 MiB 405.4 MiB
  • Wall time for prefix, median of 5 runs after 1 warm-up, from a clean output directory each time. Both tools were given the worker count explicitly (1 against 1, 12 against 12). Memory is peak total across all processes, sampled on Linux. Strauss PHP 0.31.1 on PHP 8.4.23 (static CLI build, no OPcache, no memory limit). Strauss-RS release build. Intel i5-10600 (12 threads), 32 GB RAM. Projects: monolog (small), guzzle + flysystem + finder (medium), laravel/framework (large) and aws-sdk-php (xlarge), all with locked dependencies.