On 10/2/17 9:50 PM, Kris Maglione wrote:
For the pretty simple micro-benchmark below, here are the in-document and out-of-document numbers for three runs without the subject principal:

Sorry, I should have been clearer: I meant numbers for "inserted into the document" and "not inserted into the document".

Without inserting the div into the document, the numbers were closer to 500ns, with or without the subject principal, in- or out-of-document.

Gotcha.

I just did a bit of testing with a non-inlined no-op function and it looks like the overhead of NeedsSubjectPrincipal is on the order of maybe 1-2ns. Looks like the actual implementation we end up using mostly consists of reinterpret_cast, which is nice and fast. ;) There's one memory read from the JSContext to get the compartment, and one memory read from the compartment to get the principal; as long a those hit cache all is good.

I haven't tested a sandbox with X-rays

Yeah, not going to be a big factor there.

Sounds to me like just using NeedsSubjectPrincipal is fine here. Thank you for checking this stuff!

-Boris
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to