-
Notifications
You must be signed in to change notification settings - Fork 171
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
stdout.write performance improvements #617
Comments
On txiki you want to await the write call, can you try that? |
There is a 16ms interval between each output, perhaps due to the terminal support issue? So adding await does not seem to improve it |
Interesting. I'll take a look! |
The problem can be improved by reducing the terminal size to some extent, I encountered a similar problem in rqjs, and realized it by refreshing the terminal every time, because it displayed a very large string without line breaks, and I'm not sure about txiki's logic yet.
This issue should not be a high priority, different platforms and terminal tools may also have an impact |
Can you give #618 a try? It's not on par with Node, but I believe it has improved things quite a bit! The use of a different way to clear the screen was spot on! |
D:/a/txiki.js/txiki.js/src/vm.c:222:tjs__promise_rejection_tracker: Assertion `(JS_IsException(event)) == (0)' failed. |
Oh so weird! I am not getting that on macOS! Looks like an unhandled rejection happened and creating the internal PromiseRejectionEvent failed, weird! Do you have a full tracback by any chance? |
Does tjs have an option to generate tracelog? There is no such problem on Ubuntu, and the tjs.exe also does not work on Windows. |
This code throw Error on windows
|
Thanks, that helps! I force-pushed with a fix. Blocking writes are only a thing on Windows when using pipes, so added an extra check. Can you test again please? |
Now it works! |
Does it perform better? |
Unfortunately there doesn't seem to be |
On macOS I can tell the difference, since resetting the terminal is more expensive than clearing it, so still worth doing. I'll keep this open and continue digging as time allows! |
Depending on what code is use My tests don't involve a TTY. Here's my results re "performance" of 0 'nm_qjs' 0.10419999998807906 |
Here is a simple example to fill the terminal and move a space:
When running with tjs, the terminal will flicker, but nodejs will run smoothly. It is not clear whether it is a platform problem of Windows, or the implementation of console.clear is different from deno/node.
deno/console/clear
I tried running snake game with txiki, and it had no functional issues except for the terminal flickering.
https://github.com/ahaoboy/r-tui-txiki/blob/main/src/snake.tsx
The text was updated successfully, but these errors were encountered: