Hi,
Thank's for pointing this out for me. I didn't realize how to use
these constructs correctly. Seeing the !-mark i just thought that
assoc! was to be used like set! set-car! set-cdr! in Scheme... my
mistake.
On Tue, Aug 4, 2009 at 8:49 PM, Jarkko Oranen wrote:
>
> On Aug 4, 11:08 am, Jonas w
On Aug 4, 11:08 am, Jonas wrote:
> Can you give any hints on how I can make the transient sort faster? I
> would like to get as close as possible to the native Java speed.
You are comparing apples to oranges. Clojure's persistent vectors do
not magically turn into Java arrays when using the new
On Aug 4, 11:08 am, Jonas wrote:
> Hi
>
> I'm playing with the new transient/persistent! features in Clojure. I
> have implemented quicksort as described on wikipedia (http://
> en.wikipedia.org/wiki/Quicksort#Algorithm). Here is the code:
>
> (defn swap-index! [v i j]
> (let [tmp (v i)]
>
I haven't tried the code, so caveat emptor:
If you convert partition to a macro *AND* use type-hints, I suspect
you'll see a win. The issue here is the primitive boxing that must
occur when when calling a function. It's my hope that when a macro is
used with the appropriate type hints, the Cloj
On Tue, Aug 4, 2009 at 3:55 PM, Albert Cardona wrote:
>
> Jonas wrote:
>> Can you give any hints on how I can make the transient sort faster? I
>> would like to get as close as possible to the native Java speed.
>
>
> My guess is that you need primitive type hints. For example:
>
> (let [piv
I get ~8% performance boost by turning swap-index! into a macro:
(defmacro swap-index! [v i j]
`(let [tmp# (~v ~i)]
(assoc! ~v ~i (~v ~j))
(assoc! ~v ~j tmp#)))
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Grou
Jonas wrote:
> Can you give any hints on how I can make the transient sort faster? I
> would like to get as close as possible to the native Java speed.
My guess is that you need primitive type hints. For example:
(let [pivot-value (v pivot-index)]
could be:
(let [pivot-value (int
Hi
I'm playing with the new transient/persistent! features in Clojure. I
have implemented quicksort as described on wikipedia (http://
en.wikipedia.org/wiki/Quicksort#Algorithm). Here is the code:
(defn swap-index! [v i j]
(let [tmp (v i)]
(assoc! v i (v j))
(assoc! v j tmp)))
(defn p