This comes to mind:
(set! *warn-on-reflection* true)
But you probably already considered it...

On Sun, Oct 21, 2012 at 4:27 AM, Brian Craft <craft.br...@gmail.com> wrote:

> I have a vector of maps representing intervals with (start, end) coords in
> one dimension, that are non-overlapping, and sorted. At the moment I'm not
> using a sorted data type, just a vector.
>
> The bottleneck in my code is in searching for intervals that overlap a
> region, like so:
>
> (defn filter-probe-range [probes start end]
>   (filter #(and (> (:end %) start) (< (:start %) end)) probes))
>
> My first thought to speed it up was to add a binary search on the vector,
> since it's sorted. However, that is wildly slower than doing a full scan
> with filter. I'm not sure why that is, or how to investigate it. I've
> looked over the section on performance in "The Joy of..", but nothing is
> really popping out. Should I start with jvisualvm? Is there something
> better that would identify what I'm doing that's so slow?
>
> Also wondering if sorted data types would do this for me for free. Is
> there a way to do a binary search on a sorted collection?
>
> --
> 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




-- 
I may be wrong or incomplete.
Please express any corrections / additions,
they are encouraged and appreciated.
At least one entity is bound to be transformed if you do ;)

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