[pypy-commit] pypy default: Add a performance hack: llop.gc_writebarrier

arigo noreply at buildbot.pypy.org
Mon Dec 15 16:46:37 CET 2014


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r74940:5fc98f5c2d94
Date: 2014-12-15 15:46 +0000
http://bitbucket.org/pypy/pypy/changeset/5fc98f5c2d94/

Log:	Add a performance hack: llop.gc_writebarrier

diff --git a/rpython/rtyper/lltypesystem/rordereddict.py b/rpython/rtyper/lltypesystem/rordereddict.py
--- a/rpython/rtyper/lltypesystem/rordereddict.py
+++ b/rpython/rtyper/lltypesystem/rordereddict.py
@@ -605,6 +605,10 @@
         newitems = lltype.malloc(lltype.typeOf(d).TO.entries.TO, new_allocated)
     else:
         newitems = d.entries
+        # The loop below does a lot of writes into 'newitems'.  It's a better
+        # idea to do a single gc_writebarrier rather than activating the
+        # card-by-card logic (worth 11% in microbenchmarks).
+        llop.gc_writebarrier(lltype.Void, newitems)
     #
     ENTRIES = lltype.typeOf(d).TO.entries.TO
     ENTRY = ENTRIES.OF


More information about the pypy-commit mailing list