From e9d547af073389efbed81b0155023aaf5a3d5eb8 Mon Sep 17 00:00:00 2001 From: Hugo Thunnissen Date: Thu, 17 Aug 2023 14:33:43 +0200 Subject: [PATCH] Add compilation/benchmarks section to README --- README.md | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/README.md b/README.md index 0037e5f..e695c85 100644 --- a/README.md +++ b/README.md @@ -76,6 +76,52 @@ git clone https://git.snorba.art/hugo/phpinspect.el ~/projects/phpinspect.el (require 'phpinspect) ``` +## Compilation +It is highly recommended to byte- or native compile phpinspect. Aside from the +normal performance boost that this brings to most packages, it can reduce +phpinspect's parsing time by up to 90%. It especially makes a difference when +incrementally parsing edited buffers. For example: + +### benchmarks/parse-file.el uncompiled on Ryzen 5 3600 (time in seconds): +``` +Incremental parse (warmup): +Elapsed time: 0.168390 (0.019751 in 1 GC’s) +Incremental parse: +Elapsed time: 0.143811 (0.000000 in 0 GC’s) +Incremental parse (no edits): +Elapsed time: 0.000284 (0.000000 in 0 GC’s) +Incremental parse repeat (no edits): +Elapsed time: 0.000241 (0.000000 in 0 GC’s) +Incremental parse after buffer edit: +Elapsed time: 0.012449 (0.000000 in 0 GC’s) +Incremental parse after 2 more edits: +Elapsed time: 0.015839 (0.000000 in 0 GC’s) +Bare (no token reuse) parse (warmup): +Elapsed time: 0.048996 (0.000000 in 0 GC’s) +Bare (no token reuse) parse: +Elapsed time: 0.052495 (0.000000 in 0 GC’s) +``` + +### benchmarks/parse-file.el with native compilation on Ryzen 5 3600 (time in seconds): +``` +Incremental parse (warmup): +Elapsed time: 0.023432 (0.000000 in 0 GC’s) +Incremental parse: +Elapsed time: 0.018350 (0.000000 in 0 GC’s) +Incremental parse (no edits): +Elapsed time: 0.000076 (0.000000 in 0 GC’s) +Incremental parse repeat (no edits): +Elapsed time: 0.000058 (0.000000 in 0 GC’s) +Incremental parse after buffer edit: +Elapsed time: 0.001212 (0.000000 in 0 GC’s) +Incremental parse after 2 more edits: +Elapsed time: 0.001381 (0.000000 in 0 GC’s) +Bare (no token reuse) parse (warmup): +Elapsed time: 0.013874 (0.000000 in 0 GC’s) +Bare (no token reuse) parse: +Elapsed time: 0.013878 (0.000000 in 0 GC’s) +``` + ## Development ### Running tests