From 277ef97eeb9de2ad5982f44e5a34c0969e494bc0 Mon Sep 17 00:00:00 2001 From: Nikodemus Siivola Date: Mon, 4 May 2009 19:28:44 +0000 Subject: [PATCH] 1.0.28.9: open code ARRAY-RANK * Faster multidimensional AREF if the array rank is not known at compile-time. --- NEWS | 3 +++ src/compiler/array-tran.lisp | 13 ++++++++----- version.lisp-expr | 2 +- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/NEWS b/NEWS index b7a366b..3d05ffc 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,7 @@ ;;;; -*- coding: utf-8; fill-column: 78 -*- + * optimization: multidimensional array accesses in the absence of type + information regarding array rank are approximately 10% faster due to + open coding of ARRAY-RANK. * bug fix: disable address space randomization Linux/x86-64 as well, not just x86-64. (reported by Ken Olum) * bug fix: #201; type inference for CONS and ARRAY types could derive diff --git a/src/compiler/array-tran.lisp b/src/compiler/array-tran.lisp index dfd1664..dadb0dc 100644 --- a/src/compiler/array-tran.lisp +++ b/src/compiler/array-tran.lisp @@ -461,11 +461,14 @@ (deftransform array-rank ((array)) (let ((array-type (lvar-type array))) (let ((dims (array-type-dimensions-or-give-up array-type))) - (if (not (listp dims)) - (give-up-ir1-transform - "The array rank is not known at compile time: ~S" - dims) - (length dims))))) + (cond ((listp dims) + (length dims)) + ((eq t (array-type-complexp array-type)) + '(%array-rank array)) + (t + `(if (array-header-p array) + (%array-rank array) + 1)))))) ;;; If we know the dimensions at compile time, just use it. Otherwise, ;;; if we can tell that the axis is in bounds, convert to diff --git a/version.lisp-expr b/version.lisp-expr index 8033af8..9d0525a 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".) -"1.0.28.8" +"1.0.28.9" -- 1.7.10.4