From luke at stat.uiowa.edu  Tue Dec 18 19:00:14 2007
From: luke at stat.uiowa.edu (Luke Tierney)
Date: Tue, 18 Dec 2007 12:00:14 -0600 (CST)
Subject: [Rd] Improvement of SignRank functions
In-Reply-To: <18276.8363.639290.462401@ada-stat.math.ethz.ch>
References: <4762FDB9.1060603@iugrina.com>
	<18275.47774.724113.430936@ada-stat.math.ethz.ch>
	<4763D2E6.90301@iugrina.com>
	<18276.8363.639290.462401@ada-stat.math.ethz.ch>
Message-ID: <Pine.LNX.4.64.0712181159060.18642@nokomis.stat.uiowa.edu>

On Sat, 15 Dec 2007, Martin Maechler wrote:

> Hi Ivo,
>
>>>>>> "IU" == Ivo Ugrina <ivo at iugrina.com>
>>>>>>     on Sat, 15 Dec 2007 14:13:10 +0100 writes:
>
>    IU> Martin Maechler wrote:
>    >> do you have evidence for your belief?
>    >> i.e. a set of  system.time(.) calls where you see the
>    >> difference?
>
>    IU> system.time(dsignrank(17511, 400))
>    IU> user  system elapsed
>    IU> 1.010   0.120   1.145
>    IU> system.time(dsignrank((0:17511), 400))
>    IU> user  system elapsed
>    IU> 1.25    0.13    1.40
>    IU> system.time(dsignrank((0:17511), 500))
>    IU> user  system elapsed
>    IU> 2.040   0.220   2.296
>    IU> system.time(psignrank((0:17511), 600))
>    IU> user  system elapsed
>    IU> 20.670   0.580  21.403
>    IU> system.time(qsignrank(0.56, 300))
>    IU> user  system elapsed
>    IU> 0.700   0.050   0.753
>    IU> ======================================
>    IU> system.time(dsignrank(17511, 400))
>    IU> user  system elapsed
>    IU> 0.070   0.000   0.078
>    IU> system.time(dsignrank((0:17511), 400))
>    IU> user  system elapsed
>    IU> 0.100   0.000   0.104
>    IU> system.time(dsignrank((0:17511), 500))
>    IU> user  system elapsed
>    IU> 0.160   0.000   0.164
>    IU> system.time(psignrank((0:17511), 600))
>    IU> user  system elapsed
>    IU> 16.330   0.370  16.729
>    IU> system.time(qsignrank(0.56, 300))
>    IU> user  system elapsed
>    IU> 0.020   0.010   0.029
>
>
>
>    IU> system.time(dsignrank((0:20000), 600))
>    IU> user  system elapsed
>    IU> 3.470   0.280   3.745
>    IU> RAM: ~130MB
>    IU> ======================================
>    IU> system.time(dsignrank((0:20000), 600))
>    IU> user  system elapsed
>    IU> 0.250   0.010   0.26
>    IU> RAM: ~1MB
>
> that's quite convincing; thank you!
> and I can verify part of it on my computer.
>
> I think I'd just commit your signrank.c
> (with a few cosmetic changes) to the sources, right?
>
> *Not* using a static with all the previously computed counts
> is probably not possible without a (CPU time) efficiency loss;
> and to make this thread-safe one could use a "thread-global"
> array, but how to do that would really depend on the threading
> system used, and that's not at all given.

I'ts possible to handle this sort of thing with OpenMP, which is I
think the way we want to go, but it does require some care.

luke


>
> Thank you for your contribution!
> Martin
>
>
>
>    >> BTW: If you had a smart idea to *not* use a static 'w' and still
>    >> be memory efficient,
>    >> that could lead to make that code "thread-safe", but I am
>    >> not at all sure this is possible without using
>    >> "thread-library C code".
>
>    IU> I'll look into it.
>
>
>    IU> With respect,
>    IU> --
>    IU> Ivo Ugrina
>    IU> ICQ: 47508335 | www.iugrina.com
>    IU> -------------------------------
>    IU> baza matematickih pojmova
>    IU> http://baza.iugrina.com
>    IU> ---------------------------
>    IU> anime, manga, Japan fanzin
>    IU> http://yoshi.iugrina.com
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

-- 
Luke Tierney
Chair, Statistics and Actuarial Science
Ralph E. Wareham Professor of Mathematical Sciences
University of Iowa                  Phone:             319-335-3386
Department of Statistics and        Fax:               319-335-3017
    Actuarial Science
241 Schaeffer Hall                  email:      luke at stat.uiowa.edu
Iowa City, IA 52242                 WWW:  http://www.stat.uiowa.edu



[Rd] Improvement of SignRank functions
Luke Tierney