Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to turn off enter watching? #43

Open
slifin opened this issue Feb 1, 2022 · 2 comments
Open

Is it possible to turn off enter watching? #43

slifin opened this issue Feb 1, 2022 · 2 comments

Comments

@slifin
Copy link

slifin commented Feb 1, 2022

This could very well be my usage of bat-test being incorrect but I have some code where (bat-test) is called and then that's invoked from a boot-test, when I run VisualVM on that boot process this section appears to take a fair amount of CPU:

https://github.com/metosin/bat-test/blob/master/src/metosin/bat_test/impl.clj#L18

Since we point bat-test at all our tests anyway I don't think this section of code is doing much for us? Is it possible to optionally disable or avoid it?

@frenchy64
Copy link
Contributor

FWIW the CLI interface I proposed has an :enter-key-listener arg, might be worth duplicating this feature for Leiningen.

https://github.com/metosin/bat-test/pull/44/files#diff-332c74e4e4ec874dff7255a66cae0cebaab586ed1d0bc46029090d65cc0f1493R225

frenchy64 added a commit to frenchy64/bat-test that referenced this issue Feb 4, 2022
@Deraen
Copy link
Member

Deraen commented Mar 2, 2022

If VIsualVM is writes to app standard input it would explain why it takes lost of CPU time. If not, it is just overhead from the debugger, but that seems unlikely, as the read call in the loop should be just blocking until there is more input to read.

I tried to check java.util.Scanner implementation and looks like it isn't doing anything else that just reading System.in. Though difference is that it is reading input into CharBuffer and then handling all read bytes, instead of calling read for one byte at a time. That might be more efficient in a case where lots of stuff is written to std in.

But makes sense to just have option to disable this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants