Easy Coding Standard - 42x faster for Everyone
The first Easy Coding Standard with --blink support was released on October 7th, 40 days ago.
What was the PHP community reaction? How does the Golang port handle real codebases? What is next?
First Experimental Version
Blink is the Go port of ECS, see Porting ECS to Go. Since ECS 13.3.3 you could use --blink to try out the fastest way to apply coding standard to PHP codebases.
I wanted to see how fast we can go in the wild without crashing... it turned out, really fast:
I've enabled the --blink flag in every coding standard script on every open-source and private project I work with. The coding standard started to run faster than I could type "ECS", it's been amazing. This became a baseline benchmark for all other tools I use. If ECS could make it, then any other PHP tool can.
No surprise I love a tool I made to save time... but how about others?
Nearly a week after the first release, ECS started to receive first Golang contributions. I don't mean a few, but 10-15 PRs a day. I was amazed, had to review really hard and fortify the CI with a couple of bench scripts and parity comparison. I sometimes struggled with merging fast enough, but I blame the GitHub Actions crashing 2 days straight.
From 178 to 299 PHP-CS-Fixer rules in 6 weeks
In the first tag that shipped the --blink we had 178 php-cs-fixer rules covered in Golang.
I thought that's nearly full parity, but I made a mistake in the parity CI check script. Instead of comparing it to php-cs-fixer itself, it only compared it to the rules that ECS used. In reality we only covered 178 of 299 php-cs-fixer rules.
Today, the ECS 13.3.19 covers all 299 rules - 100 % parity.
How did we get there?
- First, we started measuring coverage against the full php-cs-fixer universe, so we knew exactly what was missing.
- Then @gnutix listed every rule Blink did not have yet in one tracking issue and kept ticking them off as PRs got merged. That turned "port everything" into a clear checklist. Amazing work gnutix!
Today, if there is a php-cs-fixer rule without its counterpart our CI will fail.
Adoption Phase
At first, we introduced optional --blink option to collect feedback safely from those on bleeding edge. That way you could enable it on purpose and report what happens. If something would not work as expected, you can fallback to PHP.
Thanks to early feedback, we could fix missing --no-diffs option, resolve dozens of spacing glitches and fix config conversion bugs. I always made sure the fix is immediately followed by a release to improve the developer experience.
Real Numbers from the Wild
@gnutix ran Blink on their company codebase - 8 700 files, 224 rules - and shared CI timings:
| timing | |
|---|---|
| ECS, cold cache | ~147 s |
| ECS, warm cache | 4-7 s |
ECS --blink |
~2 s, no cache at all |
With ~130 CI runs per day, Blink saves ~3.5-4 hours per week and ~15-17 hours per month of computation time.
Blink needs no cache at all - there is no cache.
Blink Out of the Box
Once the dust settled, it was time to move on.
A week ago we enabled Blink by default, under these conditions:
- every rule in
ecs.phphas its counterpart in Blink - every single rule configuration is converted successfully to Blink
- there is no custom PHP rule (we cannot run those, yet)
If one of these conditions is not met, PHP handles the run. This ensures the ECS still works as before, it just runs 42x faster every time it can - the PHP run takes 42 s, the Blink run takes 1 s.
What's Next?
Speed is not only about a faster experience locally, in CI and for agents. Projects can now register their own Blink fixers - you can write custom ECS rules in Golang, however complex (ask your agent), and they'll still finish in the blink of an eye.
Compare Runs Yourself
We also added --no-blink option, so you can see how slow the PHP run is compared to the Blink run - or in case you want to make your coding standard run 42x slower.
If you find any glitch or bug, let me know. Will fix and release.
In the meantime, enjoy the blazing speed of Blink.
Happy coding!