mirror of
https://github.com/fluencelabs/jsonpath
synced 2025-04-01 14:31:05 +00:00
21 lines
437 B
Lua
21 lines
437 B
Lua
require("lib")
|
|
|
|
local iter;
|
|
if arg[1] == nil or arg[1] == '' then
|
|
iter = 5000;
|
|
else
|
|
iter = tonumber(arg[1]);
|
|
end
|
|
|
|
print(string.format("%s - %u", "lua iter", iter));
|
|
|
|
local file = io.open("../benchmark/example.json", "r");
|
|
io.input(file)
|
|
local data = io.read("*a");
|
|
io.close(file);
|
|
local template = compile("$..book[?(@.price<30 && @.category==\"fiction\")]");
|
|
for i = 0, iter do
|
|
local r = template(data);
|
|
-- print(r);
|
|
end
|