[Spice-devel] OT: Remove X == TRUE tests for non-boolean values

Frediano Ziglio fziglio at redhat.com
Tue Feb 28 09:50:53 UTC 2017


> ...

> > > over 10000 mostly empty surfaces. There will be one extra indirection
> > > when
> > > accessing the surface_client_lossy region, but x86_64 became pretty darn
> > > good at chasing pointers like that thanks to C++ vtables ;-)
> > 
> 

> > Last sentence is a bit cryptic I think :-)
> 

> Sorry. Did not mean to be. What I meant is that chasing pointers like a->b->c
> is required to perform well for virtual function calls in C++ (this->foo()
> translates into this->vptr->vtbl[n]()). At some point, it was a huge
> performance hit for many workloads, because CPUs were not that good at
> prefetching this kind of double-dereferences. But C++ and other similar
> programming techniques with double indirection became so prevalent that CPUs
> are now quite good at it.

Was thinking at some more complicated like recent destructuring or something. 
I think the most optimization came from h/w having more caches :-) 
It's true that C++ can do more optimization that C as it has the full control of vtables (like merging 
or putting in separate sections) but still you have the double dereference. 
On the other way even Linux kernel uses a lot of xxxx_ops structures that are quite similar to 
C++ vtables. I think you have two options basically... or you copy the function pointers for each 
object (not really flexible, could be costly for small object or lot of pointers and hard to change 
dynamically) or use the double dereference. 

Frediano 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20170228/786c066f/attachment.html>


More information about the Spice-devel mailing list