waylandpp icon indicating copy to clipboard operation
waylandpp copied to clipboard

Excessive copying of wrapper instances

Open yol opened this issue 7 years ago • 1 comments

During debugging I noticed that for one call to a function that takes a waylandpp proxy_t as argument, around 5 copies of the proxy object were constructed and then destroyed again. While it might not matter much for performance, I think that it's unnecessary and also makes stepping through the code a lot harder. What do you think of using const references for the arguments in most places? I know that this won't completely get rid of copying probably, but it should save a few ones.

(I'm willing to write the patch, but I wanted to discuss this first.)

yol avatar Jun 06 '17 11:06 yol

I have not spent very much time on optimisation, since my PhD thesis consumes most of my time at the moment. So as long as the existing examples don't need to get changed, I agree that const references are indeed a good idea. :)

NilsBrause avatar Jun 07 '17 16:06 NilsBrause