Author: Remi Meier Branch: c7 Changeset: r700:04bbddecdb33 Date: 2014-01-31 16:32 +0100 http://bitbucket.org/pypy/stmgc/changeset/04bbddecdb33/
Log: small performance improvements thanks to cache-line alignment of locks (thanks kirma) diff --git a/c7/stmsync.c b/c7/stmsync.c --- a/c7/stmsync.c +++ b/c7/stmsync.c @@ -18,10 +18,10 @@ lock, so don't conflict with each other; when we need to do a global GC, we take a writer lock to "stop the world". */ -rwticket rw_shared_lock; /* the "GIL" */ -rwticket rw_collection_lock; /* for major collections */ +rwticket rw_shared_lock __attribute__((aligned(64))); /* the "GIL" */ +rwticket rw_collection_lock __attribute__((aligned(64))); /* for major collections */ -sem_t static_thread_semaphore; +sem_t static_thread_semaphore __attribute__((aligned(64))); uint8_t static_threads[NB_THREADS]; /* 1 if running a pthread */ __thread struct _thread_local1_s *pthread_tl = NULL; diff --git a/duhton/Makefile b/duhton/Makefile --- a/duhton/Makefile +++ b/duhton/Makefile @@ -11,11 +11,15 @@ C7HEADERS = ../c7/*.h -all: duhton_debug duhton +all: duhton_debug duhton duhton: *.c *.h $(C7SOURCES) $(C7HEADERS) clang -pthread -g -O2 -o duhton *.c $(C7SOURCES) -Wall +duhton_release: *.c *.h $(C7SOURCES) $(C7HEADERS) + clang -pthread -g -DNDEBUG -O2 -o duhton_release *.c $(C7SOURCES) -Wall + + duhton_debug: *.c *.h $(C7SOURCES) $(C7HEADERS) clang -pthread -g -DDu_DEBUG -o duhton_debug *.c $(C7SOURCES) -Wall diff --git a/duhton/demo/sort.duh b/duhton/demo/sort.duh --- a/duhton/demo/sort.duh +++ b/duhton/demo/sort.duh @@ -77,13 +77,14 @@ (setq half_len (/ (len xs) 2)) (setq first (list)) (setq second (list)) - - (while (< 0 (len xs)) - (if (< 0 half_len) - (append first (pop xs 0)) - (append second (pop xs 0)) + (setq xidx 0) + + (while (< xidx (len xs)) + (if (< xidx half_len) + (append first (get xs xidx)) + (append second (get xs xidx)) ) - (setq half_len (- half_len 1)) + (setq xidx (+ xidx 1)) ) (list first second) @@ -172,7 +173,7 @@ (setq current (time)) (print (quote before-random)) -(setq cs (random_list 100000)) +(setq cs (random_list 200000)) (print (quote time-random:) (- (time) current)) ;; (print_list cs) _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit