lectrote icon indicating copy to clipboard operation
lectrote copied to clipboard

Files need to be less aggressively output buffered

Open curiousdannii opened this issue 8 years ago • 3 comments

Lectrote is currently heavily buffering output to data files.

On Ubuntu it seems to flush every 256 bytes. On Windows it seems to write out 4Kb blocks, but only when you quit Lectrote.

In neither OS will it flush the buffer when you quit (so if your command file doesn't reach 4Kb in Windows nothing will be recorded.) Neither do they flush the buffer after a certain amount of time.

It is of course essential that all the data actually gets written. As long as it does that the method of buffering doesn't matter, but from my user's perspective, I'd prefer a time based approach rather than a data length approach. (Or Lectrote could not bother buffering and let the OS handle it.)

curiousdannii avatar Jan 20 '17 11:01 curiousdannii

Let me see... I am calling the Node fs.writeSync function for all writes. (https://nodejs.org/api/fs.html#fs_fs_writesync_fd_buffer_offset_length_position) I don't see a flush function in the API to add to that? Unless I've screwed up the sequencing of my own fflush method, this may be a Node problem.

erkyrath avatar Jan 20 '17 16:01 erkyrath

I don't think this is waiting on an electron fix because it happens when I use electrofs.js in pure Node.

curiousdannii avatar Jan 07 '18 04:01 curiousdannii

"Waiting on node fix" is what I meant, but the label is close enough.

erkyrath avatar Jan 08 '18 05:01 erkyrath