Comments (3)
From looking at the code, it seems that the problem is the usage of functools.lru_cache
in https://github.com/lk-geimfari/mimesis/blob/master/mimesis/providers/base.py#L126. If I understand correctly, this is meant to load the JSON data only once, but the problem is that the cache is keyed on all function arguments, including self
, which will be different for every instance. So this cache doesn't really do anything useful (each instance will load the data again), and also keeps the data from every instance around indefinitely.
A quick solution is to just remove lru_cache
from this function. It won't cache anything, but the current cache is not useful anyway, and it will free memory after usage.
A possibly better solution is to move all parts of that function that don't depend on self
to a staticmethod and cache the staticmethod instead.
from mimesis.
Well, I've fixed this issue. I've removed lru_cache since it works even faster without it. I'll release 6.0.0
soon.
from mimesis.
@vbuaraujo Correct, but instancing in the loop is absolutely unnecessary, so I'm not sure that we should do something about this problem.
from mimesis.
Related Issues (20)
- Generic.reseed doesn't seem to work on internal providers HOT 3
- Remove inappropriate words from email addresses HOT 4
- Datetime.datetime throws TypeError: 'Datetime' object is not callable HOT 5
- Generic provider does not have a per instance random generator. HOT 1
- Make it possible to use custom seed in custom provider HOT 3
- Fail of query_string
- Make providers flyweight HOT 2
- US locale-based addresses include non-US street suffixes HOT 2
- Address provider function country() does not apply locale or support allow_random param HOT 2
- Reset increment HOT 6
- Mistype in person name HOT 2
- Use of underscore in examples HOT 1
- Reseeding doesn't return consistent data for some providers HOT 7
- NSFW words generated by `Text.words` in `en` HOT 3
- Generating dummy country data with mimesis only returns 'United States' HOT 8
- Improve the quality of tests
- 8.0.0: pytest is failing in 34 units HOT 8
- Schema Generation from JSON HOT 3
- 9.0.0: sphinx warnings `reference target not found`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mimesis.