Author Topic: Duplicate/Copy List  (Read 5843 times)

0 Members and 1 Guest are viewing this topic.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Duplicate/Copy List
« Reply #15 on: August 06, 2010, 10:49:08 PM »
I did initially.

The program finished before the timer clicked in.

:D
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8728
  • AKA Daniel
Re: Duplicate/Copy List
« Reply #16 on: August 06, 2010, 10:52:18 PM »
I mean with a larger list I.e

Code: [Select]
IntCollection intList = new IntCollection();
      for (int i = 0; i < 10000; i++)
        intList.Add(i);

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Duplicate/Copy List
« Reply #17 on: August 06, 2010, 10:54:00 PM »


ahhhh ... obviously my dear Watson.

I'll finish lunch first.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8728
  • AKA Daniel
Re: Duplicate/Copy List
« Reply #18 on: August 06, 2010, 11:03:20 PM »
I'm still working on breakfast, rice congee  :laugh:

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Duplicate/Copy List
« Reply #19 on: August 06, 2010, 11:08:16 PM »
Here we go .... one million itterations of  cloning a 10 thousand element integer list
8.48  for old.ToList<int>()
vs
8.39 seconds for new List<int>(old)
« Last Edit: August 06, 2010, 11:11:41 PM by Kerry Brown »
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8728
  • AKA Daniel
Re: Duplicate/Copy List
« Reply #20 on: August 06, 2010, 11:33:27 PM »
not much difference

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Duplicate/Copy List
« Reply #21 on: August 06, 2010, 11:37:09 PM »

Nope ... but clocking it beats guessing :)
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Andrey Bushman

  • Swamp Rat
  • Posts: 864
Re: Duplicate/Copy List
« Reply #22 on: August 07, 2010, 02:44:47 AM »
I think what consider of crumbs not actually  :-)

Glenn R

  • Guest
Re: Duplicate/Copy List
« Reply #23 on: August 07, 2010, 03:31:55 AM »
Iwas merely showing another way. Personally, I would do it the same as Kerry.

I was actually showing the foreach...

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Duplicate/Copy List
« Reply #24 on: August 07, 2010, 07:47:58 PM »
I think what consider of crumbs not actually  :-)
This needs translating for me :)

Iwas merely showing another way. Personally, I would do it the same as Kerry.

I was actually showing the foreach...

I got what I asked for Glenn ; variations on a theme :)

Yes, the foreach method was particularly interesting for me.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.