From: "Adam C. Emerson" <aemerson@redhat.com>
To: Somnath Roy <Somnath.Roy@sandisk.com>
Cc: Samuel Just <sjust@redhat.com>, Casey Bodley <cbodley@redhat.com>,
Sage Weil <sweil@redhat.com>,
"Samuel Just (sam.just@inktank.com)" <sam.just@inktank.com>,
"ceph-devel@vger.kernel.org" <ceph-devel@vger.kernel.org>
Subject: Re: queue_transaction interface + unique_ptr + performance
Date: Thu, 3 Dec 2015 20:43:58 -0500 [thread overview]
Message-ID: <20151204014358.GA7239@ultraspiritum.redhat.com> (raw)
In-Reply-To: <CO1PR02MB208F2A592CD7CF75DF71346F40C0@CO1PR02MB208.namprd02.prod.outlook.com>
On 04/12/2015, Somnath Roy wrote:
[snip]
> ##### Test Shared Smart ptr ######
> micros_used for shared ptr: 27105354
One thing to keep in mind is that, if there are any cases where we really DO
want to use shared_ptr, if we find ourselves assigning a new pointer then
releasing an old one, it's better to std::move from one to the other, since it
doesn't have to use locking/atomics to fiddle with the refcount in that case.
But if we can avoid them, all the better.
[snip]
> 2. I have also measured the cost of list::push_back etc. , all is expected.. if I replace list with vector again I am getting *some benefit* , which is also expected I guess.
If we have some idea how many elements we expect/want to hold, calling reserve
will get all our allocations done all at once rather than dipping into the heap
multiple times.
> I am not seeing any conclusion on the interface change...Here is my understanding so far..
>
> 1. For the method like apply_transaction() which is taking Transaction reference now, I will not be changing the interface , instead will do an extra copy to create unique_ptr inside.
>
> 2. For all the cases taking Transaction* , I will change that to TransactionRef&&
>
> 3. The queue_transactions() will be changed to vector< TransactionRef> instead of list< Transaction*>
>
> Let me know if I am missing anything..
My understanding is that in some cases we might not want to use the heap. (For
example, if we're executing a transaction synchronously rather than enqueing
it.) And to make Transaction movable. Then we would not build a
std::vector<TransactionRef>, what we would build instead is
std::vector<Transaction>
In this case, we should probably have everything just take Transaction&& (so the
caller can expect to have the contents of the transaction moved out.
We might also want to consider building a transaction in place. I know I
saw one constructor that takes bufferlist. If there are other cases where
we could benefit from just passing in arguments and having the transaction
built right into the vector (with emplace_back), that would be even
better than constructing it on the stack and moving it in to the vector.
--
Senior Software Engineer Red Hat Storage, Ann Arbor, MI, US
IRC: Aemerson@{RedHat, OFTC, Freenode}
0x80F7544B90EDBFB9 E707 86BA 0C1B 62CC 152C 7C12 80F7 544B 90ED BFB9
next prev parent reply other threads:[~2015-12-04 1:44 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-03 2:13 queue_transaction interface + unique_ptr + performance Somnath Roy
2015-12-03 3:50 ` James (Fei) Liu-SSI
2015-12-03 3:59 ` Somnath Roy
2015-12-03 7:21 ` Somnath Roy
2015-12-03 8:42 ` Piotr.Dalek
2015-12-03 11:50 ` Sage Weil
2015-12-03 15:16 ` Casey Bodley
2015-12-03 16:52 ` Somnath Roy
2015-12-03 17:17 ` Adam C. Emerson
2015-12-03 17:40 ` Somnath Roy
2015-12-03 17:48 ` Samuel Just
2015-12-03 17:02 ` Somnath Roy
2015-12-03 17:25 ` Adam C. Emerson
2015-12-03 17:48 ` Somnath Roy
2015-12-03 17:50 ` Samuel Just
2015-12-03 17:52 ` Samuel Just
2015-12-03 17:53 ` Somnath Roy
2015-12-03 19:09 ` Casey Bodley
2015-12-03 19:12 ` Adam C. Emerson
2015-12-03 19:14 ` Samuel Just
2015-12-03 19:29 ` Casey Bodley
2015-12-03 19:33 ` Samuel Just
2015-12-03 20:14 ` Casey Bodley
2015-12-03 21:06 ` Sage Weil
2015-12-03 21:23 ` Casey Bodley
2015-12-03 23:23 ` Samuel Just
2015-12-04 0:25 ` Somnath Roy
2015-12-04 1:43 ` Adam C. Emerson [this message]
2015-12-04 6:15 ` Somnath Roy
2015-12-04 6:43 ` Somnath Roy
2016-01-18 20:48 ` Somnath Roy
2015-12-03 19:04 ` Matt Benjamin
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20151204014358.GA7239@ultraspiritum.redhat.com \
--to=aemerson@redhat.com \
--cc=Somnath.Roy@sandisk.com \
--cc=cbodley@redhat.com \
--cc=ceph-devel@vger.kernel.org \
--cc=sam.just@inktank.com \
--cc=sjust@redhat.com \
--cc=sweil@redhat.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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.