@@ -93,20 +93,76 @@ jobs:
9393 run : |
9494 php -d extension="$NATIVE_EXT" tests/tools/run-native-ast-walk-benchmark.php | tee native-walk.txt
9595
96+ - name : Check out baseline (PR base, no identity cache)
97+ run : |
98+ git fetch --no-tags --depth=1 origin codex/native-lazy-ast-facade
99+ git worktree add ../baseline FETCH_HEAD
100+
101+ - name : Install Composer dependencies (baseline mysql-on-sqlite)
102+ uses : ramsey/composer-install@v3
103+ with :
104+ working-directory : ../baseline/packages/mysql-on-sqlite
105+ ignore-cache : " yes"
106+ composer-options : " --optimize-autoloader"
107+
108+ - name : Build baseline parser extension (release)
109+ run : cargo build --release
110+ working-directory : ../baseline/packages/php-ext-wp-mysql-parser
111+
112+ - name : Stage benchmark + corpus into baseline
113+ run : |
114+ mkdir -p ../baseline/packages/mysql-on-sqlite/tests/mysql/data
115+ cp packages/mysql-on-sqlite/tests/tools/run-native-ast-walk-benchmark.php \
116+ ../baseline/packages/mysql-on-sqlite/tests/tools/
117+ cp packages/mysql-on-sqlite/tests/mysql/data/*.csv \
118+ ../baseline/packages/mysql-on-sqlite/tests/mysql/data/ 2>/dev/null || true
119+
120+ - name : Benchmark — baseline native path (walk, no identity cache)
121+ working-directory : ../baseline/packages/mysql-on-sqlite
122+ run : |
123+ BASE_EXT="$(realpath ../packages/php-ext-wp-mysql-parser/target/release/libwp_mysql_parser.so)"
124+ php -d extension="$BASE_EXT" tests/tools/run-native-ast-walk-benchmark.php \
125+ | tee "$GITHUB_WORKSPACE/packages/mysql-on-sqlite/baseline-native-walk.txt"
126+
127+ - name : Benchmark — baseline native path (parse only)
128+ working-directory : ../baseline/packages/mysql-on-sqlite
129+ run : |
130+ BASE_EXT="$(realpath ../packages/php-ext-wp-mysql-parser/target/release/libwp_mysql_parser.so)"
131+ php -d extension="$BASE_EXT" tests/tools/run-native-ast-walk-benchmark.php --no-walk \
132+ | tee "$GITHUB_WORKSPACE/packages/mysql-on-sqlite/baseline-native-parse-only.txt"
133+
96134 - name : Summarize
97135 if : always()
98136 working-directory : packages/mysql-on-sqlite
99137 run : |
138+ extract() {
139+ # Pull a numeric field (e.g. duration=1.23s) from a benchmark
140+ # output line. Returns "n/a" if missing.
141+ local file="$1" key="$2"
142+ [ -f "$file" ] || { echo "n/a"; return; }
143+ grep -oE "${key}=[^ ]+" "$file" | head -1 | cut -d= -f2 || echo "n/a"
144+ }
145+
100146 {
101147 echo '### Native AST walk perf'
102148 echo
103149 echo '| scenario | result |'
104150 echo '|---|---|'
105- for f in php-parse-only.txt php-walk.txt native-parse-only.txt native-walk.txt; do
151+ for f in php-parse-only.txt php-walk.txt native-parse-only.txt native-walk.txt baseline-native-parse-only.txt baseline-native-walk.txt ; do
106152 [ -f "$f" ] || continue
107153 line="$(cat "$f")"
108154 echo "| ${f%.txt} | \`$line\` |"
109155 done
156+ echo
157+ echo '### Identity-cache cost (native walk: with cache vs PR base without)'
158+ echo
159+ echo '| metric | with cache (this PR) | baseline | delta |'
160+ echo '|---|---|---|---|'
161+ for key in duration qps peak_mem walked_nodes; do
162+ with="$(extract native-walk.txt "$key")"
163+ base="$(extract baseline-native-walk.txt "$key")"
164+ echo "| $key | $with | $base | — |"
165+ done
110166 } >> "$GITHUB_STEP_SUMMARY"
111167
112168 - name : Upload raw output
0 commit comments