{"id":15525111,"url":"https://github.com/staabm/blackfire-regex","last_synced_at":"2025-06-25T22:06:29.709Z","repository":{"id":202706877,"uuid":"707959868","full_name":"staabm/blackfire-regex","owner":"staabm","description":null,"archived":false,"fork":false,"pushed_at":"2023-10-21T08:05:00.000Z","size":77,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-05T11:39:13.054Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/staabm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-10-21T05:13:11.000Z","updated_at":"2023-10-21T05:31:56.000Z","dependencies_parsed_at":null,"dependency_job_id":"56d8e1bc-2f64-42dc-9f0a-eaa8b1251f4e","html_url":"https://github.com/staabm/blackfire-regex","commit_stats":null,"previous_names":["staabm/blackfire-regex"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/staabm/blackfire-regex","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/staabm%2Fblackfire-regex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/staabm%2Fblackfire-regex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/staabm%2Fblackfire-regex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/staabm%2Fblackfire-regex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/staabm","download_url":"https://codeload.github.com/staabm/blackfire-regex/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/staabm%2Fblackfire-regex/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261960542,"owners_count":23236574,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-02T10:54:47.460Z","updated_at":"2025-06-25T22:06:29.694Z","avatar_url":"https://github.com/staabm.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# blackfire-regex\n\n## find 1\n\nsimple script which runs memory efficient without blackfire, but takes a huge amount of memory when profilling.\n\nmy feeling is, this script reproduces a problem I had over and over again, when profilling the PHPStan codebase, in which case blackfire reported too much memory used - especially in Nette/Strings::match() (regex matching)\n\n### repro\n\ncheckout https://github.com/staabm/blackfire-regex/commit/10b34994f6873f4b30f33b2f53c115b65a8af91d\n\n### run without blackfire\n\nphp nette.php              \nUsed memory: 4 MB\n\n### run with blackfire\n\nblackfire run php nette.php\nUsed memory: 4.3 GB\n\n## find 2\n\nrunning this very similar script takes 1.4 GB when PCRE is involved and only 370 MB with plain addcslashes() - both when running with blackfire.\n\nit takes the very same amount of memory when running without blackfire - just 2 MB\n\n \n\n### repro\n\nhttps://github.com/staabm/blackfire-regex/commit/e1d0071398fe933b182a96cd81f89f68a816c358\n\n \n```\n➜  blackfire-regex git:(main) ✗ php nette.php\nUsed memory: 2 MB\n➜  blackfire-regex git:(main) ✗ php plain.php\nUsed memory: 2 MB\n➜  blackfire-regex git:(main) ✗ blackfire run php nette.php\nUsed memory: 1.43 GB\n➜  blackfire-regex git:(main) ✗ blackfire run php plain.php\nUsed memory: 370 MB\n```\n\n## Setup \n\n```\nphp -v\nPHP 8.2.11 (cli) (built: Sep 26 2023 11:11:58) (NTS)\nCopyright (c) The PHP Group\nZend Engine v4.2.11, Copyright (c) Zend Technologies\n    with blackfire v1.86.3~mac-x64-non_zts82, https://blackfire.io, by Blackfire\n\nblackfire -V\nBlackfire version 2.22.0 (c) 2014-2023 Platform.sh (2023-09-28T09:21:28+0000 - dev)\n```\n\nrunning latest macos on a M1 Pro.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstaabm%2Fblackfire-regex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstaabm%2Fblackfire-regex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstaabm%2Fblackfire-regex/lists"}