Skip to content

Commit

Permalink
don't bother with i/o thread for small writes
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson committed Jun 15, 2011
1 parent ee2a770 commit 0f686e1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,14 @@ static void *run_io_thr(void *arg)
DLLEXPORT
void jl_enq_send_req(ios_t *dest, ios_t *buf)
{
if (buf->size <= 1024) {
// for small writes don't bother with the thread
size_t nw;
_os_write_all(dest->fd, buf->buf, buf->size, &nw);
ios_trunc(buf, 0);
return;
}

sendreq_t *req = (sendreq_t*)malloc(sizeof(sendreq_t));
req->fd = dest->fd;
size_t sz;
Expand Down

0 comments on commit 0f686e1

Please sign in to comment.