Re: can I make this faster (and leaner) ?

2009-11-01 Thread Emeka
Hello Sir, (def *valid-chars* (vec abcdefghijklmnopqrstuvwxuz0123456789 )) This looks cleaner. Regards, Emeka On Sat, Oct 31, 2009 at 1:15 PM, John Harrop jharrop...@gmail.com wrote: On Fri, Oct 30, 2009 at 7:47 PM, DavidF davidnfind...@gmail.com wrote: Try this: (def *valid-chars* [

Re: can I make this faster (and leaner) ?

2009-10-31 Thread John Harrop
On Fri, Oct 30, 2009 at 7:47 PM, DavidF davidnfind...@gmail.com wrote: Try this: (def *valid-chars* [ \a \b \c \d \e \f \g \h \i \j \k \l \m \n \o \p \q \r \s \t \u \v \w \x \u \z \0 \1 \2 \3 \4 \5 \6 \7 \8 \9 ] ) (defn generate-key [keylength]

can I make this faster (and leaner) ?

2009-10-30 Thread Chick Corea
How do I make this code faster? And leaner, i.e., use less memory ? It's a simple function to generate NUMKEYS strings of length KEYLENGTH, store them in a Java array then store them in a HashMapString,Object hash-map. [it doesn't store them in the hash-map yet; but it allocates it] (set!

Re: can I make this faster (and leaner) ?

2009-10-30 Thread David Nolen
The better question to ask is this real code you intend on using? Are you really going to generate 100,000 random keys of 1024 chars each all at once in a real running program? (def *valid-chars* [\a \b \c \d \e \f \g \h \i \j \k \l \m \n \o \p \q \r \s \t \u \v \w \x \u \z \0 \1 \2 \3 \4

Re: can I make this faster (and leaner) ?

2009-10-30 Thread Alex Osborne
Chick Corea wrote: The corresponding Java code (w/ the hash-insert omitted in the clojure version) runs in 5.5sec and uses 290MB. This code runs (which omits the hash-insert) runs in 17.8sec and uses 353MB. I thought that I added all of the casts and warn-on-reflections that would

Re: can I make this faster (and leaner) ?

2009-10-30 Thread DavidF
Try this: (def *valid-chars* [ \a \b \c \d \e \f \g \h \i \j \k \l \m \n \o \p \q \r \s \t \u \v \w \x \u \z \0 \1 \2 \3 \4 \5 \6 \7 \8 \9 ] ) (defn generate-key [keylength] (for [x (range keylength)] (nth *valid-chars* (rand-int (count *valid-