POV-Ray : Newsgroups : povray.off-topic : Reflections on employment : Re: Reflections on employment Server Time
29 Jul 2024 04:23:09 EDT (-0400)
  Re: Reflections on employment  
From: Orchid Win7 v1
Date: 5 Dec 2012 16:20:39
Message: <50bfbaa7@news.povray.org>
On 05/12/2012 02:22 PM, Warp wrote:
> Orchid Win7 v1<voi### [at] devnull>  wrote:
>>     public List<Int>  foobar(String s)
>
> Btw, why return a list?
>
> I know that memory allocation in C# is probably faster than it is
> in C++, but it still feels odd to use a list instead of something more
> memory-efficient (which C# most certainly ought to support) and faster
> to access. What possible advantage could there be in using a list of
> ints?
>
> Are you transferring your customs of using lists from Haskell to C#?

The C# "List" class actually represents a growable array. So it has O(1) 
index and O(1) append until the underlying array needs to be enlarged 
(which is obviously O(n) time).

The "LinkedList" class represents a (double-linked) list, with the usual 
performance characteristics you would expect for that container.

As best as I can tell, List is pretty much the default container to use 
unless you need something more specific.

You could also use a normal array. But that isn't resizable (which 
doesn't matter in this particular case).


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.