From: "Юрий Соколов" <funny.falcon@gmail.com>
To: kgio@librelist.com
Subject: Re: Re: [PATCH 3/3] add `#kgio_writev` and `#kgio_trywritev`
Date: Thu, 31 May 2012 10:16:33 +0400 [thread overview]
Message-ID: <CAL-rCA0=t5Sap=gr7P8wywv-GX+JOHQgRUg2sm0h0mNpALE-+A@mail.gmail.com> (raw)
In-Reply-To: 20120530203823.GA23189@dcvr.yhbt.net
2012/5/31 Eric Wong <normalperson@yhbt.net>
> Юрий Соколов <funny.falcon@gmail.com> wrote:
> > With many tiny strings substitution function from writev_compat.h is
> faster.
> > It seems that we should not always make call to system writev, but do it
> > depending on a data shape. I'll try play with tomorrow.
>
> Yes, I expect writev_compat (or even naive write(ary.join)) to be faster
> for tiny strings. Each iovec struct is 16-bytes on 64-bit, and this is
> a _huge_ overhead on small strings. Setting up pointers/lengths ends up
> being more expensive than copying the strings themselves.
>
> I think this optimization is best left to application authors to
> decide (and documented as such).
>
Well, it is faster even with prepared iovec , and joining string on Ruby
level is still
slower.
I think, it is easy to decide automatically whether to choose custom
function or
call library function considering average string size in a batch:
when average string size is about 1000 bytes library function is certainly
faster
when strings are of 100 bytes then custom function is much faster
Taking something around 500~700 bytes as threshold we could have a good
performance in every case.
I don't think 16 bytes is very huge overhead considering that buffer is
reused
for every batch of strings.
next prev parent reply other threads:[~2012-05-31 6:16 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-30 13:56 [PATCH 1/3] Fix UnixClientReadServerWrite test class name Sokolov Yura 'funny-falcon
2012-05-30 13:56 ` [PATCH 2/3] use rb_str_subseq for tail string on write Sokolov Yura 'funny-falcon
2012-05-30 18:57 ` Eric Wong
2012-05-30 19:29 ` Юрий Соколов
2012-05-30 13:56 ` [PATCH 3/3] add `#kgio_writev` and `#kgio_trywritev` Sokolov Yura 'funny-falcon
2012-05-30 19:55 ` Юрий Соколов
2012-05-30 20:38 ` Eric Wong
2012-05-31 6:16 ` Юрий Соколов [this message]
2012-05-31 21:10 ` Eric Wong
2012-05-30 20:39 ` Eric Wong
2012-05-31 6:26 ` Юрий Соколов
2012-05-31 21:14 ` Eric Wong
2012-05-31 21:56 ` Eric Wong
2012-05-31 9:00 ` Sokolov Yura 'funny-falcon
2012-05-31 21:19 ` Eric Wong
2012-06-01 6:14 ` Юрий Соколов
2012-06-01 7:55 ` Eric Wong
2012-06-01 9:42 ` [PATCH] " Sokolov Yura 'funny-falcon
2012-06-01 19:20 ` Eric Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://yhbt.net/kgio/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAL-rCA0=t5Sap=gr7P8wywv-GX+JOHQgRUg2sm0h0mNpALE-+A@mail.gmail.com' \
--to=funny.falcon@gmail.com \
--cc=kgio@librelist.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhbt.net/kgio.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).