Reuse generator?
See original GitHub issueHi,
Would you accept simple PR which would cache and reuse the generator during the same session?
Setting up the generator take few seconds, so in our case, when we use generateSchema
over 100 times in test, it takes crazy long time, while with a ‘hacked’ solution, it took few seconds.
What I mean is doing something like this:
let generator;
function generateSchema(program, fullTypeName, args, onlyIncludeFiles) {
if (generator=== undefined) {
generator= buildGenerator(program, args, onlyIncludeFiles);
}
Issue Analytics
- State:
- Created 2 years ago
- Comments:15 (9 by maintainers)
Top Results From Across the Web
Python: how to 'reuse' a generator? - DEV Community
Generators can help you write reusable and scalable Python code, but the problem is that complicated processing often requires using the ...
Read more >Resetting generator object in Python - Stack Overflow
Generators can't be rewound. You have the following options: Run the generator function again, restarting the generation:
Read more >Generator based reuse - Systems, Software and Technology
An alternative approach to concept reuse is generator-based reuse (Biggerstaff, 1998). In this approach reusable knowledge is captured in a program generator ......
Read more >A reusable generator in python that can be used as a decorator
class ReusableGenerator: """A decorator that allows a generator to become reusable. That is, every time you call the __iter__ method on a decorated ......
Read more >Generator Services - The Reuse Network - IRN Surplus
Surplus generators are large organizations who want to put their decommissioned reusable surplus to good use. IRN matches surplus with those in need....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ok. Will do that in the evening or tomorrow.
I did it now: https://github.com/YousefED/typescript-json-schema/pull/418
The test case is missing as I do not have the time for that now, unfortunately. Please feel free to add it (should be possible)