Hacker News new | ask | show | jobs
by general_reveal 114 days ago
Wouldn’t we need to implement all of that extra stuff if we really wanted to work with text from files? I have a use case where I do need extra fast text input/output from files. If anyone has thoughts on this, I’d love it.
1 comments

The standard way is to use libraries like libevent, libuv that wraps system calls such as epoll, kqueue etc.

The other palatable way is to register consumer coroutines on a system provided event-loop. In C one does so with macro magic, or using stack switching with the help of tiny bit of insight inline assembly.

Take a look at Simon Tatham's page on coroutines in C.

To get really fast you may need to bypass the kernel. Or have more control on the event loop / scheduler. Database implementations would be the place to look.