Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jsonpath-rw find function is slow? #95

Open
god-chaos opened this issue Dec 29, 2020 · 1 comment
Open

jsonpath-rw find function is slow? #95

god-chaos opened this issue Dec 29, 2020 · 1 comment

Comments

@god-chaos
Copy link

test code:

from jsonpath_rw import parse as parserw


@exec_time()
def test_jsonpathrw(data, field):
    jsonpath_expr = parserw(field)
    return jsonpath_expr.find(data)


js = {'z': [{'z1': 10}, {'z1': 20}]}
print(test_jsonpathrw(js, 'z')[0].value)

output is:

func:{test_jsonpathrw} exec time is:{9.79468} ms
[{'z1': 10}, {'z1': 20}]

just find 'z' node of the very simple json object. find function is so slowly. it can be work?

@god-chaos
Copy link
Author

import jsonpath


@exec_time()
def test_jsonpath(data, field):
    return jsonpath.jsonpath(data, field)

js = {'z': [{'z1': 10}, {'z1': 20}]}
print(test_jsonpath(js, 'z'))

output:

func:{test_jsonpath} exec time is:{0.47803} ms
[[{'z1': 10}, {'z1': 20}]]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant