I don't have the EXACT code handy to c/p (at work now) but I did
something like the following.
(apologies for doing it such an iterative looking way, never got
comfortable with -> ;-))

(def transhashmap (transient {})
(assoc transhashmap "a" 1)
(assoc transhashmap "b" 2)
etc

Then when I did (count transhashmap) I never got higher than 8.
Perhaps something about the way it is handling strings/characters as a
hash is broken?  I know my original code that screwed me up was taking
a long text and breaking it down into wordcounts.

~Patrick

On Aug 7, 7:38 am, Christophe Grand <christo...@cgrand.net> wrote:
> Hi Patrick !
>
> Can you post some code. here is what I get:
> user=> (-> {} transient (assoc! :a 1) (assoc! :b 2) (assoc! :c 3) (assoc! :d
> 4)
> (assoc! :e 5) (assoc! :f 6) (assoc! :g 7) (assoc! :h 8) (assoc! :i 9)
> persistent!)
> {:a 1, :c 3, :b 2, :f 6, :g 7, :d 4, :e 5, :i 9, :h 8}
> user=> (persistent! (reduce #(assoc! %1 (str "k" %2) %2) (transient {})
> (range 2
> 0)))
> {"k0" 0, "k1" 1, "k2" 2, "k3" 3, "k4" 4, "k5" 5, "k10" 10, "k6" 6, "k11" 11,
> "k7"
>  7, "k12" 12, "k8" 8, "k13" 13, "k9" 9, "k14" 14, "k15" 15, "k16" 16, "k17"
> 17,
>  "k18" 18, "k19" 19}
>
> Christophe
>
> On Fri, Aug 7, 2009 at 10:07 AM, Patrick Sullivan <
>
>
>
> wizardofwestma...@gmail.com> wrote:
>
> > Testing Transient w/Hashmaps (Thanks Cristophe!) and it seems like the
> > object won't store more then 8 keys.  At first I thought it was my
> > frequency function
> > that was rolling it up, but then I simply tried creating a transient
> > object and manually assoc! ing a bunch of items into it.  After the
> > 8th it seemed to stop taking new
> > keys.
>
> > Am I doing something silly here or is this a bug?
>
> > ~Patrick Sullivan
>
> > On Aug 6, 5:53 am, Rich Hickey <richhic...@gmail.com> wrote:
> > > On Aug 5, 10:10 pm, Luc Prefontaine <lprefonta...@softaddicts.ca>
> > > wrote:
>
> > > > I like this very much... that's the kind of clever optimizations that
> > > > preserves Clojure principles and
> > > > can yield significant performance increases. This could also help
> > > > dealing with performance critics
> > > > in these small mutable languages "benchmarks" that newbies attempt to
> > > > clone in Clojure.
>
> > > > Thank's Rich !
>
> > > You're welcome!
>
> > > And special thanks to Christophe Grand, who (quickly!) applied the
> > > same technique to the hash maps and contributed that yesterday. So
> > > now, in the master branch, vectors and hash maps support transients.
> > > Everyone please try them out (where appropriate :).
>
> > > Rich
>
> --
> Professional:http://cgrand.net/(fr)
> On Clojure:http://clj-me.blogspot.com/(en)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to