Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #147526

Re: So here's a fun challenge

From Ian Collins <ian-news@hotmail.com>
Newsgroups comp.lang.c
Subject Re: So here's a fun challenge
Date 2019-11-03 18:02 +1300
Message-ID <h275bjFa2cqU6@mid.individual.net> (permalink)
References <NNgvF.21265$hh5.17108@fx07.iad> <h26p2rFa2cqU3@mid.individual.net> <h26p7kFa2cqU4@mid.individual.net> <uzsvF.8285$Ys1.3242@fx42.iad>

Show all headers | View raw


On 03/11/2019 17:18, DFS wrote:
> On 11/2/2019 9:35 PM, Ian Collins wrote:

>> ZZZzN3DyoJU9hOy
>> ZZZZhpliD
>> ZzzzgdAwKww
>> zzZZ4waPKAofj
>> ZzZYshGXMOzI
>> zZzyp0NY0
>> zZzyo7v3
>> ZzzYLx3l2Nmnc973
>> zzZydYrs3quxF
>> ZzZy6FpMdt1Zw
>>
>> real    0m4.744s
> 
> 
> Unbelievably quick.  Nearly 10x faster than mine.  I do have a senior
> citizen processor (i5-750@2.67GHz).
> 
> 
> But I see you didn't do a case-insensitive sort.
> 
>   > ZZZzN3DyoJU9hOy
>   > ZZZZhpliD
> 
> 
> 3/4 of the proc time in my code is qsorting, which does untold
> strcasecmp's - that's where the slowdown is.
> 

That's odd - the other are in order - Ah!  The order of the tail is 
reversed ZZZzN3DyoJU9hOy is the last entry.

Your C version (modulo the windows stuff) gives:

1.4832s to create 10000000 random string elements (+ add dupes)
qsorting... 4.8799s
program ran in 7.0736s seconds

So removing dupes appears to be a hot-spot.

-- 
Ian.

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

So here's a fun challenge DFS <nospam@dfs.com> - 2019-11-02 10:53 -0400
  Re: So here's a fun challenge Bart <bc@freeuk.com> - 2019-11-02 17:08 +0000
    Re: So here's a fun challenge Richard Damon <Richard@Damon-Family.org> - 2019-11-02 15:01 -0400
      Re: So here's a fun challenge Bart <bc@freeuk.com> - 2019-11-02 19:38 +0000
        Re: So here's a fun challenge Richard Damon <Richard@Damon-Family.org> - 2019-11-02 16:07 -0400
        Re: So here's a fun challenge DFS <nospam@dfs.com> - 2019-11-03 09:29 -0500
  Re: So here's a fun challenge Bart <bc@freeuk.com> - 2019-11-02 20:36 +0000
    Re: So here's a fun challenge DFS <nospam@dfs.com> - 2019-11-03 09:33 -0500
      Re: So here's a fun challenge Paul <nospam@needed.invalid> - 2019-11-03 20:53 -0500
  Re: So here's a fun challenge Ian Collins <ian-news@hotmail.com> - 2019-11-03 14:33 +1300
    Re: So here's a fun challenge Ian Collins <ian-news@hotmail.com> - 2019-11-03 14:35 +1300
      Re: So here's a fun challenge DFS <nospam@dfs.com> - 2019-11-03 00:18 -0400
        Re: So here's a fun challenge Ian Collins <ian-news@hotmail.com> - 2019-11-03 18:02 +1300
          Re: So here's a fun challenge Bart <bc@freeuk.com> - 2019-11-03 11:19 +0000
            Re: So here's a fun challenge Ian Collins <ian-news@hotmail.com> - 2019-11-04 00:33 +1300
          Re: So here's a fun challenge DFS <nospam@dfs.com> - 2019-11-03 09:39 -0500
    Re: So here's a fun challenge Autist <autist69@gmail.com> - 2019-11-03 11:16 +0100
      Re: So here's a fun challenge Autist <autist69@gmail.com> - 2019-11-03 11:29 +0100
      Re: So here's a fun challenge Ian Collins <ian-news@hotmail.com> - 2019-11-03 23:34 +1300
      Re: So here's a fun challenge Melzzzzz <Melzzzzz@zzzzz.com> - 2019-11-03 11:04 +0000
        Re: So here's a fun challenge Autist <autist69@gmail.com> - 2019-11-03 14:56 +0100
          Re: So here's a fun challenge Autist <autist69@gmail.com> - 2019-11-03 15:36 +0100
  Re: So here's a fun challenge nobody@example.org (Scott) - 2019-11-03 17:35 +0000
    Re: So here's a fun challenge Ian Collins <ian-news@hotmail.com> - 2019-11-04 08:03 +1300
    Re: So here's a fun challenge DFS <nospam@dfs.com> - 2019-11-04 10:07 -0500
      Re: So here's a fun challenge nobody@example.org (Scott) - 2019-11-04 16:06 +0000
        Re: So here's a fun challenge DFS <nospam@dfs.com> - 2019-11-04 15:33 -0500

csiph-web