From 03df95052f395c205d7e5028e06bc043ee60125d Mon Sep 17 00:00:00 2001 From: Christophe Rhodes Date: Mon, 23 Jun 2003 08:46:05 +0000 Subject: [PATCH] 0.8.0.78.vector-nil-string.3: Fix most of the performance problem ... transforms for HAIRY-DATA-VECTOR-{REF,SET} on SIMPLE-STRING Right. The all-important "compile sbcl" benchmark is now back to about where it was (57 minutes on my laptop). There are still correctness issues to deal with, not least (sxhash (make-array 5 :element-type nil)) but this path isn't proving ridiculously expensive. --- src/compiler/generic/vm-tran.lisp | 21 +++++++++++++++++++++ version.lisp-expr | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/compiler/generic/vm-tran.lisp b/src/compiler/generic/vm-tran.lisp index 852a086..3298c81 100644 --- a/src/compiler/generic/vm-tran.lisp +++ b/src/compiler/generic/vm-tran.lisp @@ -41,6 +41,15 @@ ;;;; simplifying HAIRY-DATA-VECTOR-REF and HAIRY-DATA-VECTOR-SET +(deftransform hairy-data-vector-ref ((string index) (simple-string t)) + (let ((ctype (continuation-type string))) + (if (array-type-p ctype) + ;; the other transform will kick in, so that's OK + (give-up-ir1-transform) + `(typecase string + ((simple-array character (*)) (data-vector-ref string index)) + ((simple-array nil (*)) (data-vector-ref string index)))))) + (deftransform hairy-data-vector-ref ((array index) (array t) * :important t) "avoid runtime dispatch on array element type" (let ((element-ctype (extract-upgraded-element-type array))) @@ -94,6 +103,18 @@ index new-value))))) +(deftransform hairy-data-vector-set ((string index new-value) + (simple-string t t)) + (let ((ctype (continuation-type string))) + (if (array-type-p ctype) + ;; the other transform will kick in, so that's OK + (give-up-ir1-transform) + `(typecase string + ((simple-array character (*)) + (data-vector-set string index new-value)) + ((simple-array nil (*)) + (data-vector-set string index new-value)))))) + (deftransform data-vector-set ((array index new-value) (simple-array t t)) (let ((array-type (continuation-type array))) diff --git a/version.lisp-expr b/version.lisp-expr index eeae117..9ce03c6 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -17,4 +17,4 @@ ;;; checkins which aren't released. (And occasionally for internal ;;; versions, especially for internal versions off the main CVS ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"0.8.0.78.vector-nil-string.2" +"0.8.0.78.vector-nil-string.3" -- 1.7.10.4