On 12/25/2014 11:22 PM, smaug wrote:
On 12/23/2014 11:59 PM, Martin Thomson wrote:
On Tue, Dec 23, 2014 at 1:51 PM, L. David Baron <dba...@dbaron.org> wrote:

Just to be clear, is your problem the implicit conversion itself
or the reference count increment/decrement?

The latter -- the problem is that there's an implicit conversion
that has surprising side-effects.


Why are you surprised that when you pass a pointer to a function that the
function gets a pointer?

I agree that the performance is less than perfect. I do have to ask: at
what point do you consider the preservation of developer time more valuable
than the preservation of CPU time?  We could be writing in machine code
directly, but we made some trade-offs along the way.  There will always be
exceptions, and .get() exists to support those (or Waldo's proposed clev
hacks, I suppose).



I've spent quite some time to reduce extra addref/release calls in DOM code, and
at least there extra refcnt traffic is definitely no-no and won't be accepted 
in any
hot code paths (which many DOM code paths tend to be).
So by default the coding style / convention should reduce the number of 
addref/release calls and make it clear
when addref/release actually happen.
(returning nsCOMPtr/nsRefPtr makes this all less clear.)

And I haven't seen any proposal here which would "preserve developer time" vs. 
the current coding style
where already_AddRef is used for return values and raw pointers for params.



-Olli



Also, "developer time" includes also reviewer's time, and in general coding 
style and conventions should be
primarily for easy-to-read, not easy-to-write.
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to