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

remove requests for smaller memory usage #43

Closed
remorses opened this issue Mar 1, 2019 · 2 comments
Closed

remove requests for smaller memory usage #43

remorses opened this issue Mar 1, 2019 · 2 comments

Comments

@remorses
Copy link
Contributor

remorses commented Mar 1, 2019

I like the fact that this library is very fast compared to json schema, but in term of memory usage this lib isn't any better.
The problem Is that requests takes about 15 Mb of memory after being loaded and the result is that the module is 20 Mb big.
Maybe I will find time to replace requests with urllib, are you ok with a pull request like that?
memory_profiler result:

Line #    Mem usage    Increment   Line Contents
================================================
     6     24.7 MiB     24.7 MiB       @profile
     7                                 def main():
     8
     9     40.5 MiB     15.8 MiB           import fastjsonschema

The lib would takes 0.1 Mb of memory without requests and about 6 Mb using urllib

Line #    Mem usage    Increment   Line Contents
================================================
     6     24.7 MiB     24.7 MiB       @profile
     7                                 def main():
     8
     9     40.4 MiB     15.7 MiB           import requests

    10     40.5 MiB      0.1 MiB           import fastjsonschema
@horejsek
Copy link
Owner

horejsek commented Mar 2, 2019

That's interesting. Yes, I would allow it. There is only one call in ref_resolve, so it should be quite easy. Maybe would be good to write the test to check memory usage so in the future it will stay reasonable as well. :-)

@remorses
Copy link
Contributor Author

remorses commented Mar 3, 2019

Made pull request #44.

@remorses remorses closed this as completed Mar 3, 2019
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

2 participants