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)
- Codecov reporting wrong coverage information. HOT 8
- factory_boy integration out of the box. HOT 1
- Support python < 3.10 HOT 1
- Remove inappropriate words from your random text selections HOT 3
- A custom handler with an alias returns an error when using the alias HOT 4
- Tests that write to files fail in windows
- Duplicate/overwritten test
- 15.1.0: pytest fails onscanning units HOT 5
- Use Markdown for Readme
- Mimesis fails on FreeBSD HOT 1
- Location aware test data HOT 2
- Cannot import Person from partially initialized module. HOT 2
- Add support of GPT provider. HOT 9
- Add ASN generator.
- Finance should operate on high precision (Decimal)
- Add `from_typed_dict` schema HOT 5
- Replace black with ruff.
- Question on how to use default city for the choosen locale ( Country) HOT 1
- Support for pyodide
- Tests failing for Arabic
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.