On Thu, Jul 1, 2010 at 2:12 PM, Martin DeMello <martindeme...@gmail.com>wrote:

> I haven't benchmarked yet, but it's called frequently enough that it's
> probably worth making it efficient. (This is in code that converts a
> dictionary to a trie)
>

Random advices for speed or simplicity:
1. don't split the string but loop on the index of the string in the code
that insert it in the trie
2. Use transients for the nodes of your tries
3. Do not hash one char per one char but convert 8 chars into a long (if you
use only ASCII chars, 4 chars to a long else)
4. Have you tried (for simplicity) to directly use a Clojure Map or Set
instead of your trie for a dictionnary.
 For a small dictionary (collisions are not probable) it should not be much
more slower, and could be better.


3 and 4 are if you do not need escpecially a one-char trie for your
algorithm.

-- 
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