Is telemetry synchronous?
I noticed some unexpected slowness in the CLI. Is it possible that telemetry calls are sync?
See the following output:
E:\Projects\throwaway\x4wTest (master -> origin) ([email protected])
λ cordova telemetry on
Thanks for opting into telemetry to help us improve cordova.
E:\Projects\throwaway\x4wTest (master -> origin) ([email protected])
λ cordova -v | gnomon
2.1843s 8.1.2 ([email protected])
0.0016s
Total 2.1887s
E:\Projects\throwaway\x4wTest (master -> origin) ([email protected])
λ cordova telemetry off
You have been opted out of telemetry. To change this, run: cordova telemetry on.
E:\Projects\throwaway\x4wTest (master -> origin) ([email protected])
λ cordova -v | gnomon
1.2091s 8.1.2 ([email protected])
0.0017s
Total 1.2138s
(gnomon is the tool that measures the time it takes for each line of the output to appear, install via npm install -g gnomon.)
λ cordova -v
8.1.2 ([email protected])
The tracking should run asynchronously in a new process: https://github.com/yeoman/insight/issues/34
Well, the question in the title is answered. Should we close this or rename it to something more actionable?
Why is the CLI slower when telemtry is enabled then? Or does it still wait for that process to finish before returning to the console?
I also experience the difference. 1 s without telemetry vs 2 s with. I don't see any offenders in a 0x flame graph which does suggests that a child process is responsible for the delay. However, the child process should not be waited upon, the way it is handled:
https://github.com/yeoman/insight/blob/cb32c1a043c54d50ef1aff04c7a70f761bcb8035/lib/index.js#L85-L88
So it's maybe just the overhead of spawning a new Node.js process and doing the IPC :man_shrugging:
I think the only thing we could do is to create a minimal example that showcases this and report it at the inquirer repo. But then again, that's what https://github.com/yeoman/insight/issues/34 seems to be.