Skip to content
getelephcPublic

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

elephc logo

Bootgly logo

Bootgly 1.2 on elephc

Bootgly, compiled ahead of time.

License: MIT Follow @nahime0 on X

Bootgly 1.2.0 · 4 source patches · Bootgly route matching · finite web AOT profile

An experimental port that compiles a pinned Bootgly checkout into a native elephc HTTP binary, keeping upstream sources intact and every compatibility rewrite in a reviewable patch corpus.

Official Website


Important

This is a finite HTTP AOT profile. Bootgly supplies the route matching; elephc and explicit adapters supply the transport, request and response lifecycle. The supported behavior and current boundaries are documented below.

Current status

  • Upstream bootgly/bootgly, release v1.2.0, commit f4091c8543 is the pinned baseline. All 3,601 imported files under Bootgly/ remain byte-identical to that upstream archive.
  • Four source patches are applied to an isolated, generated five-file framework tree. Original, patched and patch-file SHA-256 hashes are checked before compilation. No PHP dependency or compiler patches are required.
  • The verified compiler is elephc 0.27.7, using --php-version 8.4 --web. PCRE2 10.47 is pinned by the native lockfile.
  • Requests run through Bootgly's Router, Route and Params, with a finite route manifest and explicit request/response adapters.
  • The verified Linux x86_64 executable is 23,010,528 bytes. All 20 HTTP integration checks passed, covering HTML, JSON, parameters, redirects, method filtering, HEAD and 404 responses.
  • Reproducible benchmarks compare this executable with the original persistent Bootgly PHP server, with OPcache and tracing JIT configurations. Results and the differences between the two request lifecycles appear below.

Reproduce the build

Requirements: Linux x86_64 for the verified build, Python 3, Bash, patch, elephc 0.27.7, and its web capability. The compiler version is pinned in .elephc-version, which elvm reads. No Composer installation or third-party PHP packages are needed.

./scripts/build-elephc.sh
python3 scripts/prepare-elephc.py --check
python3 scripts/test-elephc.py

The build regenerates and verifies its isolated framework tree, installs locked PCRE2 10.47, checks the profile, and compiles elephc/runtime/server. Build logs are in elephc/build/. ELEPHC_BIN can explicitly select another compiler executable.

Run the compiled server:

./elephc/runtime/server --listen 127.0.0.1:8080 --workers 1

Inspect the supported HTTP behavior:

curl -i http://127.0.0.1:8080/
curl -i http://127.0.0.1:8080/health
curl -i http://127.0.0.1:8080/hello/Bootgly
curl -i http://127.0.0.1:8080/users/42
curl -i http://127.0.0.1:8080/elephc
curl -i http://127.0.0.1:8080/missing

Verified routes

Request Result
GET / 200, HTML
GET /health?probe=1 200, JSON
GET /hello/Bootgly 200, Hello, Bootgly!
GET /users/42 200, User: 42
GET /users/nope 404, integer constraint rejected
GET /hello//extra 404, unmatched path
GET /elephc 302, location https://elephc.dev
GET /missing 404, Not Found
POST /health 404, unsupported method
HEAD / 200, empty body

The integration check runs these ten cases twice through one native worker, including a check that redirect headers do not leak into later requests. The test server listens only on loopback and is stopped automatically.

How the port works

elephc native HTTP worker
  -> Request and Response adapters
  -> Bootgly Router::route() and Router::cache()
  -> Bootgly Router::resolve()
  -> static handler using Route / Params
  -> Bootgly response Body
  -> Response adapter emits status, headers and body

elephc/runtime/server.php declares the finite route manifest. Static and dynamic matching, integer constraints, parameter extraction and catch-all lookup stay in the patched Bootgly router. Context, Request and Response define the boundary between that router and elephc's web runtime.

scripts/prepare-elephc.py reconstructs only the five PHP files needed by this profile under elephc/runtime/framework/. It applies the four patches with zero fuzz and verifies the resulting bytes. That generated directory, the executable and assembly are ignored by Git.

Each patch mirrors its upstream target:

Bootgly/WPI/Nodes/HTTP_Server_CLI/Router.php
patches/Bootgly/WPI/Nodes/HTTP_Server_CLI/Router.php.patch

The complete source and patch checksums live in patches/manifest.json. The pinned upstream tree remains available for inspection and for the PHP benchmark reference.

Native versus PHP benchmarks

Measured on 2026-11-12 with 10 workers per runtime, an AMD Ryzen 5 7530U and HTTP/1.1 keep-alive. All server variants share CPUs 0-7 (four physical cores); the load client uses CPUs 8-11 (two physical cores). Ten worker processes share the server CPU set rather than having ten dedicated cores. PHP 8.5.12 runs the original Bootgly server; the native binary uses elephc 0.27.7 and this port's AOT profile.

Median requests per second from three 3-second samples, after a one-second warmup per case, at 160 concurrent requests:

Route Native elephc PHP + OPcache PHP + OPcache + JIT
/ 10,931 63,763 62,308
/health 12,464 62,935 64,626
/hello/Bootgly 11,411 68,853 57,419
/users/42 10,568 66,358 52,353

PHP remains faster in this current server comparison. It retains a warmed router, while the native profile reconstructs the route manifest for each request; the transports and request/response implementations also differ. The results measure the complete local server stacks and do not isolate compiler speed.

The run tested concurrency 16 and 160, recording 72 samples, 10,227,703 valid responses and zero errors. Ten live workers and their CPU affinity were verified before every runtime round, and the worker population remained stable during measurement. Status and complete body bytes are checked for every measured response.

The largest per-case throughput median absolute deviation across the three rounds was 22.2%. Full per-round ranges are in the report.

Reproduce this ten-worker run:

python3 benchmarks/run.py --workers 10 \
  --concurrency 16 160 --warmup 1

See the benchmark guide, ten-worker results and latency tables, and raw samples and environment.

Current boundaries

This profile does not run Bootgly's complete platform bootstrap, its own TCP/reactor server, project discovery, dynamic route-file loading, nested route groups, middleware, response caching, sessions, uploads, deferred responses, database access, TLS, HTTP/2, WebSockets, or CLI tooling.

Handlers are the static closures declared in elephc/runtime/server.php; they receive the runtime adapters. Route closure rebinding to $this is omitted. Route parameters are read by value, and object-valued response bodies are outside the supported conversion profile. Unsupported discovery, middleware, route-group and response-cache operations fail explicitly.

To repeat the checks against the unmodified upstream entry points:

./scripts/check-upstream.sh

This diagnostic exits 1 on elephc 0.27.7: the original bootstrap and router load paths use runtime-dynamic includes. These failures are separate from the working finite profile.

Documentation

Bootgly is distributed under the MIT license.

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages