It doesn't count. :-)


On Wed, Mar 5, 2014 at 12:33 PM, Pascal Jasmin <godspiral2...@yahoo.ca>wrote:

> I don't know if this counts, but the 2nd is 20% faster than Joe's
> alternate (x at 1e6 not 1e7)
>
>    ts' (/:~ [ /:) x'
> 110.779/sec 9.43923MB
>    ts' (/:~ ; /:) x'
> 77.8271/sec 9.43962MB
>
>
>
> ----- Original Message -----
> From: Joe Bogner <joebog...@gmail.com>
> To: programm...@jsoftware.com
> Cc:
> Sent: Wednesday, March 5, 2014 2:38:54 PM
> Subject: Re: [Jprogramming] a good bar bet!
>
> Sorting and grading separately seems faster
>
> timer=: 6!:2
> x=:(1e7 $ 26?26) { 'abcdefghijklmnopqrstuvwxyz'
> NB. incumbent
> timer 's=: x{~g=: /:x'
> 0.0914002
>
> NB. alternate
> timer 'S=: /:~x[G=: /:x'
> 0.0668677
>
> s-:S
> 1
>    G-:g
> 1
>
>
> I am speculating that sorting does it in place? which is faster than
> the selection from the grade
>
>
>
> On Wed, Mar 5, 2014 at 2:02 PM, Raul Miller <rauldmil...@gmail.com> wrote:
> > Hmm...
> >
> > G=:a.i.S=:/:~x
> > is faster.
> >
> > But while s-:S, g and G are different.
> >
> > So I'm drawing a blank here, on how to make the grade.
> >
> > Thanks,
> >
> > --
> > Raul
> >
> >
> >
> > On Wed, Mar 5, 2014 at 1:52 PM, Roger Hui <rogerhui.can...@gmail.com>
> wrote:
> >
> >> Suppose x is a long vector of characters and you need both its sort and
> its
> >> grade.  Can you do it faster than s=: x{~g=: /:x ?
> >>
> >> Posed this way, the answer is of course yes.  But how, and why is it
> >> faster?
> >> ----------------------------------------------------------------------
> >> For information about J forums see http://www.jsoftware.com/forums.htm
>
> >>
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to