Skip to content

Instantly share code, notes, and snippets.

View ondrejmirtes's full-sized avatar

Ondřej Mirtes ondrejmirtes

View GitHub Profile
@ondrejmirtes
ondrejmirtes / vm-stack-page-churn-benchmark.md
Created August 17, 2026 20:00
Zend VM stack page churn on a fragmented heap: benchmark + reproducer

VM stack page churn on a fragmented heap

A call stack whose depth repeatedly oscillates across a VM stack page boundary allocates and frees a 256KB page on every oscillation (zend_vm_stack_extend() on the way down, zend_vm_stack_free_call_frame_ex()'s immediate efree() on the way back). Each of those allocations is served by zend_mm_alloc_large(), whose search for contiguous free pages degrades on a large, fragmented heap — in the worst case scanning every chunk's free-page bitmap, failing, and falling back to an mmap/munmap round-trip per oscillation.

<?php
declare(strict_types = 1);
(function () use ($argv) {
array_shift($argv);
$previousMessages = [];
foreach (range(0, 10) as $level) {
unset($outputLines);
AllowedIPs = 1.0.0.0/8, 2.0.0.0/8, 3.0.0.0/8, 4.0.0.0/6, 8.0.0.0/7, 11.0.0.0/8, 12.0.0.0/6, 16.0.0.0/4, 32.0.0.0/3, 64.0.0.0/2, 128.0.0.0/3, 160.0.0.0/5, 168.0.0.0/6, 172.0.0.0/12, 172.32.0.0/11, 172.64.0.0/10, 172.128.0.0/9, 173.0.0.0/8, 174.0.0.0/7, 176.0.0.0/4, 192.0.0.0/9, 192.128.0.0/11, 192.160.0.0/13, 192.169.0.0/16, 192.170.0.0/15, 192.172.0.0/14, 192.176.0.0/12, 192.192.0.0/10, 193.0.0.0/8, 194.0.0.0/7, 196.0.0.0/6, 200.0.0.0/5, 208.0.0.0/4, 10.189.252.1/32
<?php declare(strict_types = 1);
namespace Slevomat\PHPStan\Rules;
class BooleanInBooleanAndRule implements \PHPStan\Rules\Rule
{
public function getNodeType(): string
{
return \PhpParser\Node\Expr\BinaryOp\BooleanAnd::class;
@ondrejmirtes
ondrejmirtes / keybase.md
Created August 17, 2017 17:11
keybase.md

Keybase proof

I hereby claim:

  • I am ondrejmirtes on github.
  • I am ondrejmirtes (https://keybase.io/ondrejmirtes) on keybase.
  • I have a public key whose fingerprint is 19AB 1FB8 9EF5 88C9 6EF0 A00B 8E73 0BA2 5823 D8B5

To claim this, I am signing this object:

RelayCon 2016

I came to my first WWDC for two reasons: to experience the event first-hand and to meet my favourite blogging and podcaster heroes. I've been following the Apple community for about five years now so I finally decided it will be worth it to fly across the globe from Prague, Czech Republic to San Francisco.

I looked forward to RelayCon a lot and managed to get a ticket. It was great to meet all of the people I let talk to my ears so many hours every week!

I met Russell Ivanovic and talked to him for quite a while. I found our conversation so immersive that it almost felt like we're doing a podcast together. I also made a couple of friends who are not celebrities in this community.

I also introduced myself and talked to: David Smith, David Sparks, Daniel Jalkut, Ben Brooks, Craig Hockenberry and Federico Viticci. But I was looking forward the most to meet the hosts of my favo(u)rite podcast: ATP.

<?php declare(strict_types = 1);
class PromiseTimer
{
/** @var \React\EventLoop\LoopInterface */
private $loop;
public function __construct(\React\EventLoop\LoopInterface $loop)
{
@ondrejmirtes
ondrejmirtes / FshlHandler.php
Created April 20, 2014 18:31
FSHL Handler for Texy
<?php
namespace AmphibianDemo\Model;
use FSHL\Highlighter;
use Texy;
use TexyHandlerInvocation;
use TexyHtml;
use TexyModifier;
<?php
use Guzzle\Http\Url;
use Nette\Diagnostics\Debugger;
use Nette\Utils\Strings;
use React\Http\Request;
use React\Http\Response;
use React\SocketClient\ConnectionManager;
use React\Stream\Stream;
var WebSocketWrapper = function(url) {
this.url = url;
this.registeredFunctions = {};
this.ws = null;
this.retry = true;
};
WebSocketWrapper.prototype.send = function(message) {
this.ws.send(JSON.stringify(message));
}