Creating generative art with PHP!
summary
Recreates the open source primitive algorithm in PHP using imagex / imaging and profiles it with Blackfire to find real bottlenecks: repeated export_image_pixels and compare_images calls. Implements a pixel cache, replaces pixel iterators with indexed loops, narrows RMSD to a bounding box and rewrites the difference routine, and iteratively measures gains. Results show dramatic cuts in IO and memory and about a 90% speedup vs the initial PHP run with final timed runs around 22 seconds compared to JavaScript 2m30s.
AI-written summary · about
chapters (11)
- 0:00Start
- 3:44Optimizing the Performance
- 6:26Random Triangles
- 14:11Scaling the Target Image
- 15:35Calculating the Average Color of an Image
- 18:13Step Three
- 21:04Mutate Shape Function
- 22:39Profiling Tools
- 33:46Color Value
- 35:45Optimization Graph
- 38:21Takeaways
related talks
25mCrazy Fun Experiments with PHP (Not for Production)
39mPHP Performance Demystified - Measure, Understand, Optimise
50mPerformance optimization: how do I go about it?
24mArtisanal Rendering: Make Your Own Computer Art!
46mOptimizing Page Experience in PHP
52mPerformance optimisation: how do I go about it?
37mCreative Coding for Fun and (Non)Profit
43mVideo Games in PHP 👾: from the game loop to collisions
