kjdev/php-ext-jq

Filter string cache

codemedic opened this issue · 0 comments

Thanks for creating this php extension.

Just a suggestion on the way this can be made more usable in a long-running application (php daemons/services).

If it was possible to load and cache a filter as an object; I think it will improve the performance, when processing more than one JSON objects with the same filter. If there is a limitation on the implementation of jq itself, then obviously this is not possible.

A sample code would look like

$jq = new Jq();
$filter = $jq->loadFilter("."); // ideally a more complex one than this :)
while ($json = read_some_source()) {
    $filter->process($json);
}

Just throwing some ideas; depending on the implementation, I hope you will be able to keep the current API of the extension.