[plt-scheme] Re: Catalogs 0.7

From: Martial Tarizzo (tarizzo at ese-metz.fr)
Date: Thu Sep 19 14:24:34 EDT 2002


> I think I might be seeing something like what Shriram saw.  I had it
> create a catalog of /usr/src, watched it frantically update the tree
> (bottom left pane), and got a file 2137993 bytes big.  (I only run
> 'make clean' just *before* building.)  It does well searching for
> expressions with only a few hits, but I gave up on .o$ after a few
> minutes.  Just an experiment, my lazy man's guess is that it's too
> eager updating the display.

I think I've found the problem : to fill the lists, I use in Catalogs
the Append method.
For small lists, it's ok. But for very long list, It seems to
sollicitate a lot the garbage collector (with the test program below,
watch the GC icon flashing in DrScheme ...)
I didn't noticed this behavior, because cataloging CD-roms doesn't
produce very big catalogs.

I choosed to use Append, because I need to associate a data to each list
item, and the other method to populate a list (Set) doesn't allow this
directly : you have to sweep the list a second time to associate data
with each item. So I made the wrong choice ...

I just tested the two methods, and the second is much faster than the

Really easy to fix, just wait for Catalogs 0.8 !

About UI : I really appreciate the tab-panel% class introduced in 202.3
(finalized in 203 ?)
Could it be possible to have also :
- toggle-button% ( -> toolbars), because I didn't figure how to do it
with the standard button% class.
- horizontal scroll-bar for lists ?


Martial Tarizzo

(module list-filling-test mzscheme
  (require (lib "class.ss")
           (lib "mred.ss" "mred"))
  ; number of items in the list
  (define nmax 10000)
  (define (rev-iota n)
    (if (= n 0)
        (cons n (rev-iota (- n 1)))))
  (define w
    (instantiate frame% ()
      (label "List-filling test")
      (width 300) 
      (height 500)))
  (define lb (instantiate list-box% ()
               (label "test list")
               (parent w)
                (lambda (l e)
                  (send w set-status-text 
                         (send lb get-data
                               (send lb get-selection))))))
               (choices '())))
  (define hp
    (instantiate horizontal-panel% (w) 
      (alignment '(center center))
      (stretchable-height #f)))
  (instantiate button% 
    ("With Append" hp (lambda (b e)
                        (send lb set '())
                        (do ((i nmax (- i 1)))
                          ((= i 0) #f)
                          (send lb append 
                                (number->string i) i)))))
  (instantiate button% 
    ("With Set" hp (lambda (b e)
                     (send lb set (map number->string (rev-iota nmax)))
                     (do ((i nmax (- i 1)))
                       ((= i 0) #f)
                       (send lb set-data (- nmax i) i)))))
  (send w create-status-line) 
  (send w show #t))

Posted on the users mailing list.