bmalloc: speed up the lock slow path
Created attachment 286629 [details] Patch
Attachment 286629 [details] did not pass style-queue: ERROR: Source/bmalloc/bmalloc/StaticMutex.cpp:26: Found other header before WebCore config.h. Should be: config.h, primary header, blank line, and then alphabetically sorted. [build/include_order] [4] ERROR: Source/bmalloc/bmalloc/StaticMutex.cpp:40: More than one command on the same line [whitespace/newline] [4] Total errors found: 2 in 6 files If any of these errors are false positives, please file a bug against check-webkit-style.
Comment on attachment 286629 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=286629&action=review > Source/bmalloc/ChangeLog:26 > + To correct these problems, this patch adds a little bit of spinning to > + the bmalloc lock slow path. Nice. > Source/bmalloc/bmalloc/StaticMutex.cpp:40 > + auto clear = makeScopeExit([&] { m_isSpinning.clear(); }); LOL. I can't make up my mind if this is awesome or confusing. > Source/bmalloc/bmalloc/ThreadSwitch.h:38 > + swtch(); What is this?
> > Source/bmalloc/bmalloc/StaticMutex.cpp:40 > > + auto clear = makeScopeExit([&] { m_isSpinning.clear(); }); > > LOL. I can't make up my mind if this is awesome or confusing. I kinda like it -- similar to the defer keyword in Go and Swift. The other option I considered was a "TestAndSetScope" class, which would clear() in its destructor if it had set in its constructor. > > Source/bmalloc/bmalloc/ThreadSwitch.h:38 > > + swtch(); > > What is this? Documented here: https://www.gnu.org/software/hurd/gnumach-doc/Hand_002dOff-Scheduling.html. My reading of the implementation is that it just runs the "find another thread to run" algorithm, without changing your priority or power management or anything.
Committed r204744: <http://trac.webkit.org/changeset/204744>
Committed r204749: <http://trac.webkit.org/changeset/204749>
This appears to be ~6% progression on Dromaeo DOM Core bench on MacBookAirs.
On Speedometer, I also see a ~4% progression on MacBook Air and a ~2% progression on MacBook Pro.
I can't seem to reproduce a Dromaeo DOM Core or Speedometer speedup locally on my MacBook Air. (I see a fraction of a % speedup or no change. I didn't compute a confident interval.)
Rolled out in https://trac.webkit.org/changeset/205022
Committed r205210: <http://trac.webkit.org/changeset/205210>