On Wed, Dec 22, 2010 at 10:19 PM, Rayne <disciplera...@gmail.com> wrote:
> private static int countNumChars(String s) {
>        int num = s.length();
>        for (int i = 0; i < s.length(); i++) {
>                if (s.charAt(i) == ' ') {
>                        num--;
>                }
>        }
>        return num;
> }
>
> Is one of the fastest I've seen. It runs around 4366.293

Does it speed up any further if you manually hoist the s.length() out
of the loop?

It's encouraging that the fastest Clojure implementation we've found
takes only ~25% longer on your machine.

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