pantoniou / libfyaml

Fully feature complete YAML parser and emitter, supporting the latest YAML spec and passing the full YAML testsuite.
MIT License
241 stars 74 forks source link

stdin based input does too much buffering #34

Closed hapejot closed 3 years ago

hapejot commented 3 years ago

I am using the stdin based input for reading a sequence of documents. These documents are produced in another program that pipes the result to the next program.

My problem right now is that the output on stdout is flushed without problem, but the receiving program does to good a job in buffering the input. I am passing several tiny documents before the first one is even recognized by the parser.

Question is, why is the buffering done anyway? the stdio functions already have a buffering and some standard ways to tweak it. So fyaml doesn't need to add another layer of buffer in my opinion. For my purposes I am removed the buffering and it worked fine.

pantoniou commented 3 years ago

Looks like you're doing streaming mode input. If latency is your main concern you should use that.

There's nothing stopping you adding a special non-buffering mode as an input mode, and patches would be welcome.