Re: [PHP] json stream filter
[email protected] (Larry Garfield)
| Newsgroups | php.general |
|---|---|
| Message-ID | <[email protected]> |
On 06/20/2013 04:26 AM, Markus Staab wrote: > Hi! > > first post on the list, so please bare with me ;-) > > we are handling a lot of cache files in our apps and use json to persist > those contents on the filesystem, because it seems to be the fastest > possible way to read/write files with PHP. > > Since I discovered stream-filters, http://www.php.net/manual/en/filters.php, > we use those also for base64 encoding files before sending them over the > wire, which preserves a lot of memory and allows even bigger files. > > Would it make sense to also have a native stream filter for fileformats > like JSON, to get maximum performance for reading/writing those (and also > to be able to write big files)? > > Thanks, > Markus What would it do, exactly? Stream filters still have to read/write a string, don't they? Unless you're talking about reading directly into a nested array structure (what json_decode() does), I am not sure what the benefit is of what you're describing. (And I'm not sure you could do that, although it would be neato if you could.) --Larry Garfield