https://github.com/mozilla-servo/libwapcaplet/commit/1c3343639571d65bc0c45cab8253dabe33aace9e
introduced locking in libwapcaplet (in October 2012, by Brian Anderson). Does 
anyone remember
why this was necessary?

rust_lwc_lock calls pthread_mutex_lock
lwc_string_ref calls rust_lwc_lock
rust_lwc_string_ref calls lwc_string_ref
from_lwc_string calls rust_lwc_string_ref
NetSurf CSS callbacks (node_has_id, node_has_class) call from_lwc_string
NetSurf CSS callbacks (node_has_id, node_has_class) can be called millions of 
times
even for a relatively simple page (GitHub source code view)

So we call pthread_mutex_lock millions of times to layout a page. We measured 
that this accounts
for 10%(!) of CSS selector matching time.

I am curious if locking is unnecessary, or failing that, if locking can be done 
higher up in less
fine grained way instead of doing millions of times. While this all may be 
unnecessary after we
move to the new style system, I still want to understand what's going on since 
it seems plausible
to me that we may encounter analogous problem even in the new style system.

Thanks!
_______________________________________________
dev-servo mailing list
dev-servo@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-servo

Reply via email to