From: SASADA Koichi <ko1@atdot.net>
To: ruby-core@ruby-lang.org
Subject: [ruby-core:61466] Re: [REJECT?] xmalloc/xfree: reduce atomic ops w/ thread-locals
Date: Thu, 13 Mar 2014 22:29:46 +0900 [thread overview]
Message-ID: <5321B2CA.60104@atdot.net> (raw)
In-Reply-To: <20140312000622.GA7155@dcvr.yhbt.net>
Hi Eric,
Currently, `malloc_increase' (and so on) only a *hint*.
So I think we can eliminate atomic instruction simply. What do you think
about?
# basically, GVL protects multi-threads parallel update of such values.
# this atomic operations only for call_without_gvl().
# so it is minor case.
(2014/03/12 9:06), Eric Wong wrote:
> I'm unsure about this. I _hate_ the extra branches this adds;
> and most of our benchmarks don't show an improvement. But this
> seems like an obvious experiment, so maybe somebody else would've
> tried it if I didn't at least publish it here.
>
>
> Atomic operations are expensive, so use thread-local counters and
> only perform atomic operations when the local counters hit a
> predefined limit (currently 16K).
>
> This gives a ~12% speedup to the bm_so_count_words.rb benchmark
> which does many small mallocs. This pattern is common in some Ruby
> scripts doing text processing, so maybe it is worth doing.
>
> Unfortunately, this adds more branches, increases code size, and
> hurts accuracy of GC accounting in multithreaded programs. Some
> benchmarks are slower as a result.
>
> Full benchmark results in the full patch:
>
> http://bogomips.org/ruby.git/patch?id=8271ec7b977
> git://80x24.org/ruby.git gc-lessatomic
>
--
// SASADA Koichi at atdot dot net
next prev parent reply other threads:[~2014-03-13 13:33 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-12 0:06 [ruby-core:61424] [REJECT?] xmalloc/xfree: reduce atomic ops w/ thread-locals Eric Wong
2014-03-12 0:09 ` [ruby-core:61425] " Charlie Somerville
2014-03-12 1:07 ` [ruby-core:61426] " Eric Wong
2014-03-13 13:29 ` SASADA Koichi [this message]
2014-03-13 17:12 ` [ruby-core:61471] " Eric Wong
2014-03-14 6:20 ` [ruby-core:61488] " Eric Wong
2014-03-15 7:15 ` [ruby-core:61508] " SASADA Koichi
2014-03-15 8:34 ` [ruby-core:61509] " Eric Wong
2014-03-15 9:27 ` [ruby-core:61510] " SASADA Koichi
2014-03-15 20:41 ` [ruby-core:61519] " Eric Wong
2014-03-20 4:23 ` [ruby-core:61604] " SASADA Koichi
2014-03-20 8:12 ` [ruby-core:61608] " SASADA Koichi
2014-03-20 8:13 ` [ruby-core:61609] " SASADA Koichi
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-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.ruby-lang.org/en/community/mailing-lists/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5321B2CA.60104@atdot.net \
--to=ruby-core@ruby-lang.org \
/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.
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).