quicktype icon indicating copy to clipboard operation
quicktype copied to clipboard

CLI very slow

Open SurushS opened this issue 8 years ago • 15 comments

I'm just wondering whether it is normal behavior that a built quicktype takes around 15-20 seconds to actually generate a class from a json file. Is this normal behavior and if so, is it because of all the dependencies? I'm trying to generate C# classes with json schema's as input and its really slow.

SurushS avatar Feb 01 '18 11:02 SurushS

Could you share your schema with us? What is the file size at least? This is very slow for JSON schema input.

I don't think it's the dependencies—quicktype has relatively few.

dvdsgl avatar Feb 01 '18 14:02 dvdsgl

If you just invoke quicktype without any options, how long does that take?

schani avatar Feb 01 '18 15:02 schani

When invoking QuickType without parameters it takes ages. Doesn’t matter with or without so my guess was something in the initialization of QuickType

SurushS avatar Feb 01 '18 16:02 SurushS

How did you install quicktype? Via NPM?

schani avatar Feb 01 '18 16:02 schani

What version of node and what OS?

dvdsgl avatar Feb 01 '18 16:02 dvdsgl

i run it in my own container and basically followed the readme on github to install. node version v8.9.4 and its a container running ubuntu version 16.04 LTS

SurushS avatar Feb 02 '18 07:02 SurushS

also ran quicktype through NPM yes

SurushS avatar Feb 02 '18 07:02 SurushS

Can you please give us much more information? What is the host OS? Docker version? Host RAM? Docker RAM?

dvdsgl avatar Feb 02 '18 07:02 dvdsgl

Well actually I’m running it in AKS (Azure managed Kubernetes environment) with no restrictions set on resources on Docker level. The Nodes that it is running on are standard Dv3 vms on azure (standard on AKS).

It’s running on a self hosted VSTS Agent which in turn uses Ubuntu as its base image. This it the link

The environment doesn’t affect it though. I have the same issue running the same container locally on my i7 32GB desktop with all the default preinstalled Docker settings

SurushS avatar Feb 02 '18 07:02 SurushS

appcenter-cli is a similar JavaScript CLI on npm — what do you get for time appcenter help?

dvdsgl avatar Feb 02 '18 08:02 dvdsgl

i have the same issue if i get your docker image from the hub and try it locally or on Azure. It takes between 12-15 seconds to show the help. Appcenter though, both on my own created image as well as your own docker image shows help instantly.

qtype1 qtype2

SurushS avatar Feb 02 '18 08:02 SurushS

I see the problem. This is not how you run quicktype. For some reason you are running our development script that reinstalls dependencies and compiles quicktype whenever you run it, as least in these screenshots.

Here is how to run quicktype:

$ npm install -g quicktype 
$ quicktype

Or to run from source, which you appear to be doing:

$ npm install # build quicktype 
$ node dist/cli.js

How did you come to use quicktype this way? What are you trying to do with quicktype? Perhaps I can suggest a better way to run it as a local npm dependency.

dvdsgl avatar Feb 02 '18 14:02 dvdsgl

I basically want to use it to generate C# poco classes based on Json or json schema input through cli on my vsts Agent. That’s the goal. What would be the best approach to do that? Simply download and install the npm package and run it on the Agent in your first example ?

SurushS avatar Feb 02 '18 14:02 SurushS

Yes, install it as a global dependency with npm install -g — I don't see any reason for you to build it from source.

Is it fast now? 😄

dvdsgl avatar Feb 02 '18 14:02 dvdsgl

yeah. it's fast now. from the source out, i was looking on the wrong place apparently. I overlooked the cli.js and went straight to the quicktype script. Thanks for the quick reply! 👍

SurushS avatar Feb 02 '18 14:02 SurushS