Re: List<t> generic type - Fastest way to copy into an unmanaged array?
From: Tomas Restrepo \(MVP\) (tomasr_at_mvps.org)
Date: 10/12/04
- Next message: Robert: "Microsoft Visual C++ Runtime Library....Runtime Error"
- Previous message: Ronald Laeremans [MSFT]: "Re: Visual Studio Service Pack 5 (sp5) will not install on WindowsXP"
- In reply to: Daniel Mori: "List<t> generic type - Fastest way to copy into an unmanaged array?"
- Next in thread: Daniel Mori: "Re: List<t> generic type - Fastest way to copy into an unmanaged array?"
- Reply: Daniel Mori: "Re: List<t> generic type - Fastest way to copy into an unmanaged array?"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 11 Oct 2004 19:36:59 -0500
Daniel,
> Hi, Im hoping someone can give me some advice.
> Im doing some development using VS Whidbey 2005 beta 1.
>
> Im about to implement some highly time critical code related to a
> managed collection of floats.
>
> I basically require the fastest way to convert a managed array of
> floats into an unmanaged array of floats.
>
> As far as the managed collection is implemented, ive read that the
> following would be the most type-safe and efficient (no
> boxing/unboxing):
>
> List<float> myFloats
>
> However, Ive also read that the Marshal.Copy method is an extremely
> fast way of copying a tradional managed array into an unmanaged array.
It is indeed.
> But if i do this method (i,e use a tradional .net array), I have the
> boxing/unboxing issues.
Huh? Why boxing here? As long as you use an array of float, you won't need
boxing/unboxing. Granted, you'll end up copying a value here and there from
the stack to the managed heap where the array is stored, but it definitely
does *not* imply boxing at all (unless you for some reason declare the array
as Object* __gc[], which you probably aren't doing).
-- Tomas Restrepo tomasr@mvps.org
- Next message: Robert: "Microsoft Visual C++ Runtime Library....Runtime Error"
- Previous message: Ronald Laeremans [MSFT]: "Re: Visual Studio Service Pack 5 (sp5) will not install on WindowsXP"
- In reply to: Daniel Mori: "List<t> generic type - Fastest way to copy into an unmanaged array?"
- Next in thread: Daniel Mori: "Re: List<t> generic type - Fastest way to copy into an unmanaged array?"
- Reply: Daniel Mori: "Re: List<t> generic type - Fastest way to copy into an unmanaged array?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|