jumPhp/games/hello-threads
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-11-06 22:59:23 +01:00
..
assets Threads: TrueAsync runtime (PHP 8.6 ZTS) and Web Workers in the browser 2026-10-28 08:26:12 +01:00
config Games and sites in the playground's 14 languages: descriptions of the bundled games (fr en es de it pt nl pl ru uk tr ja zh ko), AGENTS.md: game.yaml descriptions in all of them, a game's site translated in site/<code>/ (relative paths, hreflang, language menu, sitemap) 2026-11-01 08:20:02 +01:00
src Threads: TrueAsync runtime (PHP 8.6 ZTS) and Web Workers in the browser 2026-10-28 08:26:12 +01:00
var Threads: TrueAsync runtime (PHP 8.6 ZTS) and Web Workers in the browser 2026-10-28 08:26:12 +01:00
.gitignore Threads: TrueAsync runtime (PHP 8.6 ZTS) and Web Workers in the browser 2026-10-28 08:26:12 +01:00
AGENTS.md JumPHP 0.3.0: PHP 8.5; hot reload; the game on Google Play; the jumphp command for the whole system 2026-10-29 22:17:30 +01:00
app.php Threads: TrueAsync runtime (PHP 8.6 ZTS) and Web Workers in the browser 2026-10-28 08:26:12 +01:00
composer.json gh for every forge (tools/bin/gh + tools/forge.php: GitHub -> real gh, git.jumphp.net -> forge API), JumPHP's addresses moved to git.jumphp.net, old projects' remotes follow, extension splits on the same forge 2026-11-06 21:36:17 +01:00
composer.lock composer.lock, Dockerfiles, install scripts: JumPHP's own packages and sources from git.jumphp.net 2026-11-06 22:59:23 +01:00
phpstan.neon OpenGL + OpenAL: PHP-OpenGL / PHP-OpenAL (Ponup) in every runtime 2026-10-28 16:44:36 +01:00
README.md Threads: TrueAsync runtime (PHP 8.6 ZTS) and Web Workers in the browser 2026-10-28 08:26:12 +01:00

HELLO THREADS

Le « hello world » des threads dans JumPHP : une fractale calculée ligne par ligne par un pool de threads PHP (TrueAsync), pendant que la boucle du jeu continue de dessiner à 60 images par seconde. M calcule la même image sur le thread principal pour comparer.

The "hello world" of threads in JumPHP: a fractal computed row by row by a pool of PHP threads (TrueAsync) while the game loop keeps drawing at 60 FPS. M computes the same picture on the main thread to compare.

bin/jumphp install hello-threads
bin/jumphp run hello-threads        # PHP 8.6 ZTS + TrueAsync (image built the first time, ~15 min)

Contrôles / controls: Espace / Space = zone suivante / next spot, M = threads ↔ thread principal / main thread, Échap / Escape = pause.

Dans le navigateur, le même code passe par un pool de Web Workers (un moteur PHP WebAssembly chacun). In the browser the same code uses a pool of Web Workers (one PHP WebAssembly engine each).