[music-dsp] C# Interpolation Code

Christopher Weare chriswea at microsoft.com
Thu Jan 29 20:19:43 EST 2004


While it is true that there is a virtual machine involved, there is some
confusion as to when native code is executed.  C# code is not repeatedly
run as IL.  Instead, it uses a JIT compilation mechanism similar to
Java.  Code that is run repeatedly has a good chance of running native.

Of course, this does not contradict your point that C++ is going to be
faster (unless you talk to the JIT purists who keep promising that
processing context will enable JIT approaches to someday be faster than
native code for certain applications.  This has not happened yet as far
as I am aware).

-chris

-----Original Message-----
From: music-dsp-bounces at shoko.calarts.edu
[mailto:music-dsp-bounces at shoko.calarts.edu] On Behalf Of Michael Gogins
Sent: Wednesday, January 28, 2004 6:26 PM
To: a list for musical digital signal processing
Subject: Re: [music-dsp] C# Interpolation Code

C++ is the best language for complex software that also has to run fast.
C++
is also difficult to learn. C# is not as fast because C# source code is
compiled to intermediate language, which is object language for a
virtual
machine. So when a C# program is executing, the host computer runs a
virtual
machine, and the virtual machine runs the intermediate language. C++
code
compiles directly to object language for the host computer, so there is
one
less layer of abstraction between your ideas and the microprocessor. The
actual speed difference would depend on the type of code you write, and
in
many cases C# would actually be almost as fast as C++. However, most
existing audio processing code is written in C or C++, which links
directly
with C++ code. Those same libraries can be used from C# programs, but
again,
only by going through an extra step of translation, either by writing
"managed C++" wrappers, or using the PINVOKE facility to call from C#
code
into a DLL that would probably be compiled in C++.

The speed advantage and libraries advantage of C++ are likely to be
reduced
as time goes on, but they are not going to vanish as long as C# depends
on a
virtual machine, so C++ or C are going to be the recommended languages
for
efficient application programming, especially in audio and multimedia,
for
the foreseeable future.

============================================
Michael Gogins
gogins at pipeline period com
Irreducible Productions
CsoundVST, an extended version of Csound for programming music and sound
Available at http://sourceforge.net/projects/csound/
============================================


----- Original Message ----- 
From: "Roger Waters" <rogerwaters at fastmail.fm>
To: "a list for musical digital signal processing"
<music-dsp at shoko.calarts.edu>
Sent: Wednesday, January 28, 2004 6:07 PM
Subject: RE: [music-dsp] C# Interpolation Code


> Thank you for your replies!
>
> The company I work for uses .NET as their main development platform.
> Angelo, why exactly is C# slower? Would you recommend C++ instead?
What
> about VC++?
>
> Roger.
>
>
> On Tue, 27 Jan 2004 17:07:00 +0100, "Angelo Farina"
> <farina at pcfarina.eng.unipr.it> said:
> > I don't think that C# is a good programming language for DSP... We
tested
> > it
> > some months ago, and in the benchmark it was approximately slower by
a
> > factor ten than the good, old, "unmanaged" C. We tested with FFT
> > algorithms
> > and linear convolutions, but I suppose that the same hold
approximately
> > for
> > any algorithm.
> > Why hell are You planning to use C# for DSP ???
> > Bye!
> >
> > Angelo Farina
> >
> > > -----Original Message-----
> > > From: music-dsp-bounces at shoko.calarts.edu
> > > [mailto:music-dsp-bounces at shoko.calarts.edu] On Behalf Of Roger
Waters
> > > Sent: 27 January 2004 01:52
> > > To: music-dsp at shoko.calarts.edu
> > > Subject: [music-dsp] C# Interpolation Code
> > >
> > > I'm new to C# and am looking for a linear or spline
> > > interpolation code in C#.  Does anybody know of a site where
> > > I can view similar code, or would anybody be willing to share
> > > some code for me to study?
> > >
> > > Thank you :)
> > >
> > > --
> > > http://www.fastmail.fm - Choose from over 50 domains or use
> > > your own dupswapdrop -- the music-dsp mailing list and website:
> > > subscription info, FAQ, source code archive, list archive,
> > > book reviews, dsp links http://shoko.calarts.edu/musicdsp
> > > http://ceait.calarts.edu/mailman/listinfo/music-dsp
> > >
> >
> >
> > dupswapdrop -- the music-dsp mailing list and website:
> > subscription info, FAQ, source code archive, list archive, book
reviews,
> > dsp links
> > http://shoko.calarts.edu/musicdsp
> > http://ceait.calarts.edu/mailman/listinfo/music-dsp
>
> -- 
> http://www.fastmail.fm - Does exactly what it says on the tin
> dupswapdrop -- the music-dsp mailing list and website:
> subscription info, FAQ, source code archive, list archive, book
reviews,
dsp links
> http://shoko.calarts.edu/musicdsp
> http://ceait.calarts.edu/mailman/listinfo/music-dsp

dupswapdrop -- the music-dsp mailing list and website: 
subscription info, FAQ, source code archive, list archive, book reviews,
dsp links 
http://shoko.calarts.edu/musicdsp 
http://ceait.calarts.edu/mailman/listinfo/music-dsp






More information about the music-dsp mailing list