question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hi,

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:closed
  • Created 2 years ago
  • Comments:15 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
murbanowiczcommented, Apr 13, 2021

Ok. Will do that in the evening or tomorrow.

0reactions
murbanowiczcommented, Apr 24, 2021

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)

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found