From 87f4078b259b6a7ee806712dd304a92bf06c875e Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Sat, 23 Jan 2010 20:36:54 +0000 Subject: [PATCH] simple fix to deal with performance problem noticed by jpr (this is not a complete fix, but should work in the common case of lots of repeated place-image calls) svn: r17783 original commit: 3c1d7e9acad060f9dab7b62f1a9c46d39355a31d --- collects/mrlib/image-core.ss | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/collects/mrlib/image-core.ss b/collects/mrlib/image-core.ss index ceee10e0..96f65a87 100644 --- a/collects/mrlib/image-core.ss +++ b/collects/mrlib/image-core.ss @@ -387,7 +387,16 @@ has been moved out). (let loop ([crops crops]) (cond [(null? crops) shape] - [else (make-crop (car crops) (loop (cdr crops)))]))) + [(null? (cdr crops)) + (make-crop (car crops) shape)] + [else + (let ([fst (car crops)] + [snd (cadr crops)]) + (cond + [(equal? fst snd) + (loop (cdr crops))] + [else + (make-crop (car crops) (loop (cdr crops)))]))]))) (cond [(translate? shape) (loop (translate-shape shape)