Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sdd.hp.com!spool.mu.edu!uwm.edu!bionet!agate!ucbvax!LAGUNA.METAPHOR.COM!alex From: alex@LAGUNA.METAPHOR.COM (Bob Alexander) Newsgroups: comp.lang.icon Subject: Re: Using the ``map'' function Message-ID: <9104040251.AA09079@laguna.Metaphor.COM> Date: 4 Apr 91 02:51:32 GMT Article-I.D.: laguna.9104040251.AA09079 Sender: daemon@ucbvax.BERKELEY.EDU Distribution: inet Organization: The Internet Lines: 31 Hi Paul -- In your initial procedure (the slow one) it's likely that much of the time used in repeatedly executing return map(key, collator, &ascii[33:128]) is due to the fact that every call converts the cset, &ascii, to a string. Also, there is an optimization in the iconx code for map() such that the internal translation table is not rebuilt if the second and third arguments are the same (i.e. identical descriptors) as for the previous map() call. That optimization cannot be used in your proc. Given all that, I'll bet this will execute a lot faster (the proof is left to the reader :) procedure keytrans(key) static collator, ascii initial { collator := ... ascii := &ascii[33:128] } return map(key, collator, ascii) end -- Bob Alexander Metaphor Computer Systems (415) 961-3600 x751 alex@metaphor.com ====^=== Mountain View, CA ...{uunet}!{decwrl,apple}!metaphor!alex