From 430ea31d23833983dfd3e4b68d793e9fde744f59 Mon Sep 17 00:00:00 2001 From: Matt Birkholz Date: Sat, 7 Jan 2012 10:00:19 -0700 Subject: [PATCH] cref: Eliminate needless sorting of bindings and references. Replaced package/sorted-references and package/sorted-bindings with unsorted versions package/references and package/bindings. --- src/cref/conpkg.scm | 5 ++--- src/cref/forpkg.scm | 18 +++++++----------- src/cref/object.scm | 22 ++++++++++------------ src/cref/redpkg.scm | 2 +- 4 files changed, 20 insertions(+), 27 deletions(-) diff --git a/src/cref/conpkg.scm b/src/cref/conpkg.scm index cffe6490e..efa71c3bc 100644 --- a/src/cref/conpkg.scm +++ b/src/cref/conpkg.scm @@ -55,8 +55,7 @@ USA. (list-transform-positive (pmodel/extra-packages pmodel) (lambda (package) (or (there-exists? (package/links package) link/new?) - (there-exists? (package/sorted-bindings package) - new-internal-binding?))))) + (there-exists? (package/bindings package) new-internal-binding?))))) (define (new-internal-binding? binding) (and (binding/new? binding) @@ -90,7 +89,7 @@ USA. '()))) (list->vector (map binding/name - (list-transform-positive (package/sorted-bindings package) + (list-transform-positive (package/bindings package) new-internal-binding?))) (list->vector (map (lambda (link) diff --git a/src/cref/forpkg.scm b/src/cref/forpkg.scm index 1ad91e206..2bce76456 100644 --- a/src/cref/forpkg.scm +++ b/src/cref/forpkg.scm @@ -52,7 +52,7 @@ USA. (let ((free-references (append-map! (lambda (package) (delete-matching-items - (package/sorted-references package) + (package/references package) reference/binding)) packages))) (if (pair? free-references) @@ -91,22 +91,21 @@ USA. (classify-bindings-by-package (lambda (binding) (binding/package (binding/source-binding binding))) - (package/sorted-bindings package)))) + (package/bindings package)))) (let ((class (assq package classes))) (if class (format-package/bindings port indentation width package (cdr class))) (for-each (lambda (class) (if (not (eq? package (car class))) (format-package/imports port indentation width package - (car class) - (cdr class)))) + (car class) (cdr class)))) classes) (if class (for-each (lambda (class) (if (not (eq? package (car class))) - (format-package/exports port indentation width (car class) - (sort (cdr class) bindingname binding) (append-map reference/expressions (binding/references binding)))) - bindings)) + (sort bindings bindingpackage bindings) (let ((classes '())) @@ -243,9 +242,6 @@ USA. (set-cdr! entry (cons binding (cdr entry))) (set! classes (cons (list package binding) classes)))))) bindings) - (for-each (lambda (class) - (set-cdr! class (reverse! (cdr class)))) - classes) (sort classes (lambda (x y) (package