Is there a difference of opinion between C# users and C++ users as to whether
C# is generally a replacement for C++? I asked this in the C++ thread and
most people people who responded say that C# is not a replacement for C++.
Do C# promoters have a different view?
--
Greg McPherran www.McPherran.com 33 2062
Its not an replacement but I would say for many projects its certainly an
alternative to traditional C++, and typically a lot faster to develop with
in the .NET IDE.
The resulting exeecutables are not as fast as native C or C++ (if you know
how to write C/++ of course) but its a very fast language to pick up and run
with, thus it has many advantages over coding in C++.
--
Regards
John Timney
ASP.NET MVP
Microsoft Regional Director
"Greg" <gm@mcpherran.com> wrote in message
news:EC**********************************@microsof t.com... Is there a difference of opinion between C# users and C++ users as to whether C# is generally a replacement for C++? I asked this in the C++ thread and most people people who responded say that C# is not a replacement for C++.
Do C# promoters have a different view?
-- Greg McPherran www.McPherran.com
Thank you, yes it seems like C# is a great language to RAD prototype
something iteratively and then one can always convert it to C++.
--
Greg McPherran www.McPherran.com
"John Timney ( MVP )" wrote: Its not an replacement but I would say for many projects its certainly an alternative to traditional C++, and typically a lot faster to develop with in the .NET IDE.
The resulting exeecutables are not as fast as native C or C++ (if you know how to write C/++ of course) but its a very fast language to pick up and run with, thus it has many advantages over coding in C++.
-- Regards
John Timney ASP.NET MVP Microsoft Regional Director
"Greg" <gm@mcpherran.com> wrote in message news:EC**********************************@microsof t.com... Is there a difference of opinion between C# users and C++ users as to whether C# is generally a replacement for C++? I asked this in the C++ thread and most people people who responded say that C# is not a replacement for C++.
Do C# promoters have a different view?
-- Greg McPherran www.McPherran.com
> Thank you, yes it seems like C# is a great language to RAD prototype something iteratively and then one can always convert it to C++.
If it is to convert to MC++ there is no reason (MC++ use MSIl as much as
C#).
If it is to convert to plain old C++, good luck... you should say: "one
could always spend Aeons convert it to C++"
-- Greg McPherran www.McPherran.com
"John Timney ( MVP )" wrote:
Its not an replacement but I would say for many projects its certainly an alternative to traditional C++, and typically a lot faster to develop with in the .NET IDE.
The resulting exeecutables are not as fast as native C or C++ (if you know how to write C/++ of course) but its a very fast language to pick up and run with, thus it has many advantages over coding in C++.
-- Regards
John Timney ASP.NET MVP Microsoft Regional Director
"Greg" <gm@mcpherran.com> wrote in message news:EC**********************************@microsof t.com... > Is there a difference of opinion between C# users and C++ users as to > whether > C# is generally a replacement for C++? I asked this in the C++ thread > and > most people people who responded say that C# is not a replacement for > C++. > > Do C# promoters have a different view? > > -- > Greg McPherran > www.McPherran.com
"Greg" <gm@mcpherran.com> wrote in message
news:0B**********************************@microsof t.com... and then one can always convert it to C++.
Why???
> Is there a difference of opinion between C# users and C++ users as to whether C# is generally a replacement for C++? I asked this in the C++ thread and most people people who responded say that C# is not a replacement for C++.
Do C# promoters have a different view?
Check out Kate Gregory's blog at http://www.gregcons.com/KateBlog/default.aspx.
She's a passionate promoter of of C++ and her thoughts are well worth reading.
It takes me less than half the time to develop a program in C# than it does
to develop the equivalent functionality in C++. I still can't write a low
level driver in C# tough...
Horses for courses.
--
Bob Powell [MVP]
Visual C#, System.Drawing
Ramuseco Limited .NET consulting http://www.ramuseco.com
Find great Windows Forms articles in Windows Forms Tips and Tricks http://www.bobpowell.net/tipstricks.htm
Answer those GDI+ questions with the GDI+ FAQ http://www.bobpowell.net/faqmain.htm
All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
"Greg" <gm@mcpherran.com> wrote in message
news:EC**********************************@microsof t.com... Is there a difference of opinion between C# users and C++ users as to whether C# is generally a replacement for C++? I asked this in the C++ thread and most people people who responded say that C# is not a replacement for C++.
Do C# promoters have a different view?
-- Greg McPherran www.McPherran.com
John Timney ( MVP ) wrote: The resulting exeecutables are not as fast as native C or C++ (if you know how to write C/++ of course) but its a very fast language to pick up and run with, thus it has many advantages over coding in C++.
Done any comparisons? Try it, you might be surprised.
I did some comparisons and was surprised and showed them to someone on
the C++ team and he told me that they were just what he expected.
The problem is that when most people think of .NET they think
'interpreter', or 'Java', or godforbid, Visual Basic. And so they think
'bad performance'. They shouldn't.
I think of the JIT compiler as being the back end of a C++ compiler (it
was written by people from the C++ team). If you discount the time that
the JIT compiler takes then for fully trusted code there is no reason
why it should be significantly slower than code generated by the
unmanaged C++ compiler. The only possible issue may be garbage
collection.
Of course, if you know of other areas of the .NET runtime which are
significantly slower than the equivalent in Win32 then you should post
them here so that we all can avoid using them <g>.
Richard
-- http://www.grimes.demon.co.uk/workshops/fusionWS.htm http://www.grimes.demon.co.uk/workshops/securityWS.htm
A good litmus test would be to write a prime number generator.
Then after 10000 or so just see how long it took in c# and c++.
Marc N.
--
In all the universe, and in all of space, resides a time and a place, when
you blink, let it be, in a sequence of events.
"Bob Powell [MVP]" <bob@_spamkiller_bobpowell.net> wrote in message
news:uE*************@TK2MSFTNGP09.phx.gbl... It takes me less than half the time to develop a program in C# than it does to develop the equivalent functionality in C++. I still can't write a low level driver in C# tough...
Horses for courses.
-- Bob Powell [MVP] Visual C#, System.Drawing
Ramuseco Limited .NET consulting http://www.ramuseco.com
Find great Windows Forms articles in Windows Forms Tips and Tricks http://www.bobpowell.net/tipstricks.htm
Answer those GDI+ questions with the GDI+ FAQ http://www.bobpowell.net/faqmain.htm
All new articles provide code in C# and VB.NET. Subscribe to the RSS feeds provided and never miss a new article.
"Greg" <gm@mcpherran.com> wrote in message news:EC**********************************@microsof t.com... Is there a difference of opinion between C# users and C++ users as to whether C# is generally a replacement for C++? I asked this in the C++ thread and most people people who responded say that C# is not a replacement for C++.
Do C# promoters have a different view?
-- Greg McPherran www.McPherran.com
I think the average figure I saw being spoken about was to expect up to 20%
slower. Not significant, and certainly with the increased productivity
something that can be worked on in budget if it was an issue. Personally,
I've not done a comparison to the levels you would have done Richard.
I know that some of the work I have been invoved in recently using native C
would have been unworkable in .NET as performance was the driving factor.
For me - as long as complete end to end performance was not the driving
factor I would choose c# over c/++ anytime.
--
Regards
John Timney
ASP.NET MVP
Microsoft Regional Director
"Richard Grimes" <ri******@mvps.org> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl... John Timney ( MVP ) wrote: The resulting exeecutables are not as fast as native C or C++ (if you know how to write C/++ of course) but its a very fast language to pick up and run with, thus it has many advantages over coding in C++.
Done any comparisons? Try it, you might be surprised.
I did some comparisons and was surprised and showed them to someone on the C++ team and he told me that they were just what he expected.
The problem is that when most people think of .NET they think 'interpreter', or 'Java', or godforbid, Visual Basic. And so they think 'bad performance'. They shouldn't.
I think of the JIT compiler as being the back end of a C++ compiler (it was written by people from the C++ team). If you discount the time that the JIT compiler takes then for fully trusted code there is no reason why it should be significantly slower than code generated by the unmanaged C++ compiler. The only possible issue may be garbage collection.
Of course, if you know of other areas of the .NET runtime which are significantly slower than the equivalent in Win32 then you should post them here so that we all can avoid using them <g>.
Richard -- http://www.grimes.demon.co.uk/workshops/fusionWS.htm http://www.grimes.demon.co.uk/workshops/securityWS.htm
Marc Noon <no***@bellsouth.net> wrote: A good litmus test would be to write a prime number generator.
Then after 10000 or so just see how long it took in c# and c++.
Well, that's a good litmus test if your application is going to be
processor intensive in a maths kind of way. I suspect that most
applications don't actually have a bottleneck like that. I suspect most
applications fall into one or more categories:
1) No real bottleneck - performance is perfectly acceptable
2) Database bottleneck
3) Network bottleneck
4) Graphics bottleneck (which may be processor related, but in a more
framework dependent way, eg using a framework which doesn't have
hardware acceleration)
--
Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Jon Skeet [C# MVP] <sk***@pobox.com> wrote: Well, that's a good litmus test if your application is going to be processor intensive in a maths kind of way. I suspect that most applications don't actually have a bottleneck like that. I suspect most applications fall into one or more categories:
1) No real bottleneck - performance is perfectly acceptable 2) Database bottleneck 3) Network bottleneck 4) Graphics bottleneck (which may be processor related, but in a more framework dependent way, eg using a framework which doesn't have hardware acceleration)
I missed one I'd thought of before: memory bottlenecks, where you have
to control the memory allocation really, really tightly. (Embedded
systems etc.)
--
Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
"Bob Powell [MVP]" <bob@_spamkiller_bobpowell.net> wrote in message
news:uE*************@TK2MSFTNGP09.phx.gbl... It takes me less than half the time to develop a program in C# than it does to develop the equivalent functionality in C++. I still can't write a low level driver in C# tough...
Each task has it's instruments. an interesting article about .net
applications: http://www.sysinternals.com/blog/200...im-scared.html
--
Vladimir
"Greg" <gm@mcpherran.com> wrote in message
news:0B**********************************@microsof t.com... Thank you, yes it seems like C# is a great language to RAD prototype something iteratively and then one can always convert it to C++.
It will take a big amount of time. At least because c# has different syntax,
and in c++ you should watch for commiting / releasing of memory, etc.
Yes, for a small project it would not be diffcult to convert C# code to C++,
but imagine corporate application that has a thousands of lines of code. You
will need many men-moon and time.
--
Vladimir
Another comparison.
I wrote my own rich text editor, not derived from TextBoBase, but from
Control, and handling international character through uniscribe.
If I copy paste 400Kb of text It takes roughly the same amount of time
(~1second) to do all the layouting and drawing and 20% more memory than
MS-Word.
I could tell now that I no longer believe this bullshit about .NET being
inneficient.
The certainly profile their code in C, do the same in C# and you would yield
similar results!
"Scherbina Vladimir" <vl****************@gmail.com> wrote in message
news:uv*************@TK2MSFTNGP09.phx.gbl... "Bob Powell [MVP]" <bob@_spamkiller_bobpowell.net> wrote in message news:uE*************@TK2MSFTNGP09.phx.gbl... It takes me less than half the time to develop a program in C# than it does to develop the equivalent functionality in C++. I still can't write a low level driver in C# tough...
Each task has it's instruments. an interesting article about .net applications: http://www.sysinternals.com/blog/200...im-scared.html
-- Vladimir
Marc Noon wrote: A good litmus test would be to write a prime number generator.
Then after 10000 or so just see how long it took in c# and c++.
I did it with a Fast Fourier Transform, compiled as managed C++ and
native C++. I ran the managed C++ library once before running it through
a timing loop (this was to discount the effect of JIT compilation).
Somewhere I have the results, but they varied depending on the
optimization switches I used. The fastest time was for one of the
managed C++ builds, but only just.
Richard
--
Fusion Tutorial: http://www.grimes.demon.co.uk/workshops/fusionWS.htm
Security Tutorial: http://www.grimes.demon.co.uk/workshops/securityWS.htm
Jon Skeet [C# MVP] wrote: Marc Noon <no***@bellsouth.net> wrote:
1) No real bottleneck - performance is perfectly acceptable 2) Database bottleneck 3) Network bottleneck 4) Graphics bottleneck (which may be processor related, but in a more framework dependent way, eg using a framework which doesn't have hardware acceleration)
Actually, in most cases the bottleneck is the user <g>. The application
has to wait for user imput. But I agree with you and this is why I
jumped on John for saying that .NET is slower, because 1) it isn't (I
will post results later today to show this) and 2) in many cases the
slight differences between .NET and unmanaged code is insignificant
anyway.
The one thing that might make a difference is memory allocation.
Allocation is a lot quicker in .NET than in unmanaged code, but when the
GC kicks in the .NET code gets a big hit.
Richard
--
Fusion Tutorial: http://www.grimes.demon.co.uk/workshops/fusionWS.htm
Security Tutorial: http://www.grimes.demon.co.uk/workshops/securityWS.htm
"Richard Grimes" <ri******@mvps.org> wrote in message
news:eR**************@TK2MSFTNGP14.phx.gbl... Marc Noon wrote: A good litmus test would be to write a prime number generator.
Then after 10000 or so just see how long it took in c# and c++.
I did it with a Fast Fourier Transform, compiled as managed C++ and native C++. I ran the managed C++ library once before running it through a timing loop (this was to discount the effect of JIT compilation).
Somewhere I have the results, but they varied depending on the optimization switches I used. The fastest time was for one of the managed C++ builds, but only just.
Richard -- Fusion Tutorial: http://www.grimes.demon.co.uk/workshops/fusionWS.htm Security Tutorial: http://www.grimes.demon.co.uk/workshops/securityWS.htm
Richard,
Note that the topic is C# vs. C++, if you run your FFT using C# you will
notice a performance drop compared to managed C++ (I guess you are refering
to C++/CLI) . This is the result of a slightly better optimization done by
the managed C++ compiler.
Willy.
"John Timney ( MVP )" <ti*****@despammed.com> wrote in message
news:%2***************@TK2MSFTNGP10.phx.gbl... I think the average figure I saw being spoken about was to expect up to 20% slower. Not significant, and certainly with the increased productivity something that can be worked on in budget if it was an issue. Personally, I've not done a comparison to the levels you would have done Richard.
I don't know where you got that figure from, but it is nowhere near the
figure I was told. Here are my comparisons for v2.0: http://www.grimes.demon.co.uk/dotnet/man_unman.htm
For code that is not optimized or code that is optimized for space
managed C++ is *quicker* than unmanaged code (native code takes 138% the
time of that managed code takes). In the case of optimized for speed,
the managed code takes 4% more time, so it is only slightly slower than
managed code.
I performed these measurements two years ago for v1.1 and I got a figure
of 6% longer for speed optimised managed C++ over speed optimized native
C++. I showed this to the guy responsible for performance on the C++
team and his comment was 'that looks right'. No one mentioned a figure
of 20%, and as my measurements for a computationally intensive routine
show, a figure of 20% is far too high.
In the best case native code has a mere 4% advantage over managed code.
I know that some of the work I have been invoved in recently using native C would have been unworkable in .NET as performance was the driving factor.
If it involves direct memory manipulation (which is what C was designed
to do) then I agree, but only because .NET makes a point of trying to
prevent you from performing direct memory access. If it uses
manipulation of arrays of values then C is not likely to be
significantly faster than a managed language. Furthermore, your C#
development will take a lot less time than the C development, which is
the whole point of .NET - it is now being marketed as a RAD solution.
For me - as long as complete end to end performance was not the driving factor I would choose c# over c/++ anytime.
I think you should take 'performance' out of your criteria because it
really is irrelevant in this discussion. .NET is NOT significantly
slower than native code. There are places where it is inappropriate (for
example device drivers and IMO services), but in terms of performance
you'll not notice a 4% difference.
Richard
--
Fusion Tutorial: http://www.grimes.demon.co.uk/workshops/fusionWS.htm
Security Tutorial: http://www.grimes.demon.co.uk/workshops/securityWS.htm
Willy Denoyette [MVP] wrote: Note that the topic is C# vs. C++, if you run your FFT using C# you will notice a performance drop compared to managed C++ (I guess you are refering to C++/CLI) . This is the result of a slightly better optimization done by the managed C++ compiler.
OK, if you insist, however, I don't thjink it is necessary because I
think the performance is determined by the runtime and not by the
Microsoft .NET compilers.
I have converted the managed C++ FFT routine over to C# and I have
repeated the tests. These results show that the not optimised C# library
is just slower than the not optimised C++ library, but the optimised C#
is slightly faster than the optimised managed C++ library. The
difference in the optimised librarys is very small. This reinforces the
point in the article that the *runtime* does the optimizations, and that
the optimizations provided by the .NET compilers are marginal. http://www.grimes.demon.co.uk/dotnet/man_unman.htm
Please don't suggest I repeat the test with VB.NET, I refuse to touch
that language. <g>
Richard
--
Fusion Tutorial: http://www.grimes.demon.co.uk/workshops/fusionWS.htm
Security Tutorial: http://www.grimes.demon.co.uk/workshops/securityWS.htm
Cant remember where the figure came from but I'm sure it was at a Redmond
presentation, anyway - I'm glad you enlightened me with research Richard.
The figures you quote will be useful in the future.
In my case 4% for 2 billion computations does count very much and they are
extremely large numbers involved in intense mathematical computations. In
this instance I have no choice but to consider those minor percentages. I
do however entirely agree with your point though, typically 4% is really
negligable, especially when you weight up the benefits of turnaround time
for development.
--
Regards
John Timney
ASP.NET MVP
Microsoft Regional Director
"Richard Grimes" <ri******@mvps.org> wrote in message
news:uE**************@TK2MSFTNGP14.phx.gbl... "John Timney ( MVP )" <ti*****@despammed.com> wrote in message news:%2***************@TK2MSFTNGP10.phx.gbl...I think the average figure I saw being spoken about was to expect up to 20% slower. Not significant, and certainly with the increased productivity something that can be worked on in budget if it was an issue. Personally, I've not done a comparison to the levels you would have done Richard.
I don't know where you got that figure from, but it is nowhere near the figure I was told. Here are my comparisons for v2.0:
http://www.grimes.demon.co.uk/dotnet/man_unman.htm
For code that is not optimized or code that is optimized for space managed C++ is *quicker* than unmanaged code (native code takes 138% the time of that managed code takes). In the case of optimized for speed, the managed code takes 4% more time, so it is only slightly slower than managed code.
I performed these measurements two years ago for v1.1 and I got a figure of 6% longer for speed optimised managed C++ over speed optimized native C++. I showed this to the guy responsible for performance on the C++ team and his comment was 'that looks right'. No one mentioned a figure of 20%, and as my measurements for a computationally intensive routine show, a figure of 20% is far too high.
In the best case native code has a mere 4% advantage over managed code.
I know that some of the work I have been invoved in recently using native C would have been unworkable in .NET as performance was the driving factor.
If it involves direct memory manipulation (which is what C was designed to do) then I agree, but only because .NET makes a point of trying to prevent you from performing direct memory access. If it uses manipulation of arrays of values then C is not likely to be significantly faster than a managed language. Furthermore, your C# development will take a lot less time than the C development, which is the whole point of .NET - it is now being marketed as a RAD solution.
For me - as long as complete end to end performance was not the driving factor I would choose c# over c/++ anytime.
I think you should take 'performance' out of your criteria because it really is irrelevant in this discussion. .NET is NOT significantly slower than native code. There are places where it is inappropriate (for example device drivers and IMO services), but in terms of performance you'll not notice a 4% difference.
Richard -- Fusion Tutorial: http://www.grimes.demon.co.uk/workshops/fusionWS.htm Security Tutorial: http://www.grimes.demon.co.uk/workshops/securityWS.htm
I'm impressed by your benchmarks... really. However, keep in mind that
you're comparing managed C++ versus unmanaged C++, but Redmond has
always claimed that managed C++ is faster than managed C# due to better
optimizing done by the C++.NET compiler.
That said, the last word I heard is that starting with .NET 2.0 they
would be concentrating their efforts on introducing better optimization
at the JIT stage, so any differences between the two managed languages
should diminish in the future.
"Richard Grimes" <ri******@mvps.org> wrote in message
news:e$**************@TK2MSFTNGP15.phx.gbl... Willy Denoyette [MVP] wrote: Note that the topic is C# vs. C++, if you run your FFT using C# you will notice a performance drop compared to managed C++ (I guess you are refering to C++/CLI) . This is the result of a slightly better optimization done by the managed C++ compiler. OK, if you insist, however, I don't thjink it is necessary because I think the performance is determined by the runtime and not by the Microsoft .NET compilers.
Agreed, the differences between C# and managed C++ (I've compiled to managed
code using /clr:safe) are extremely small, here it's C# which is the fastest
~5% compared with managed C++.
[my results using v2.0]
Average for native code: 9780,000 µseconds
Average for managed C++ code: 10820 µseconds
Average for managed C# code: 10272 µseconds
Other benchmarks I ran show the same pattern, sometimes C# is faster
sometimes it's slower, but the delta's remain within the +/-5% ranges. It's
also great to see the difference between native and managed getting smaller
from v1.x and v2.
I have converted the managed C++ FFT routine over to C# and I have repeated the tests. These results show that the not optimised C# library is just slower than the not optimised C++ library, but the optimised C# is slightly faster than the optimised managed C++ library. The difference in the optimised librarys is very small. This reinforces the point in the article that the *runtime* does the optimizations, and that the optimizations provided by the .NET compilers are marginal.
Agreed. http://www.grimes.demon.co.uk/dotnet/man_unman.htm
Please don't suggest I repeat the test with VB.NET, I refuse to touch that language. <g>
LOL.
Willy.
Hi Richard
I'm working on FFT project (from strach) for education purpose, I just
create nice time-domain waveform window and spectrum window and running
DFT at the moment. I would be interested to learn more of your FFT
experience in C# world.
Have you used FFTW (fastest fourier transform in the west)?, I was
wondering how you managed to setup interop service for the which is
written in C.
Is there way of keep track of the message, it does not seem to have
forward email if new message is added?.
Regards
Richard Grimes wrote: Marc Noon wrote: A good litmus test would be to write a prime number generator.
Then after 10000 or so just see how long it took in c# and c++.
I did it with a Fast Fourier Transform, compiled as managed C++ and native C++. I ran the managed C++ library once before running it through a timing loop (this was to discount the effect of JIT compilation).
Somewhere I have the results, but they varied depending on the optimization switches I used. The fastest time was for one of the managed C++ builds, but only just.
Richard -- Fusion Tutorial: http://www.grimes.demon.co.uk/workshops/fusionWS.htm Security Tutorial: http://www.grimes.demon.co.uk/workshops/securityWS.htm ri***@onetel.com wrote: I'm working on FFT project (from strach) for education purpose, I just create nice time-domain waveform window and spectrum window and running DFT at the moment. I would be interested to learn more of your FFT experience in C# world.
Not very much <g> If you asked me that 12 years ago I would be able to
tell you *everything* about the routine and the theories current at the
time. But now, all I know is that it is a computationally intensive
algorithm.
Have you used FFTW (fastest fourier transform in the west)?, I was wondering how you managed to setup interop service for the which is written in C.
I haven't used it. But the procedure is not a problem. The project on my
site shows three approaches.
1) Identify the 'main' entry point in the library and add extern "C"
__declspec(dllexport) to it, and then compile the library as a DLL. Then
use platform invoke to call it from C#.
2) Identify the 'main' entry point make this a public static method of a
public type and compile it as managed C++. Access the assembly as you
would access any other assembly from C#.
3) Convert the entire code to C#. This is perhaps the least best option,
but if the code does not use the CRT (maths routines excepted), nor uses
pointers, and only uses array syntax then it should not be too
difficult. The conversion of the project on my site took about 15
minutes. Pay particular attention to long - in C this is 32 bits, in C#
it is 64 bits.
Richard
--
Fusion Tutorial: http://www.grimes.demon.co.uk/workshops/fusionWS.htm
Security Tutorial: http://www.grimes.demon.co.uk/workshops/securityWS.htm
Regarding performance, I would hope that floating point (i.e. float, double)
math operations in .NET will still use the math hardware in the CPU. I.e. the
runtime layer, even though not native, will still access hardware facilities
as needed?
Greg <gm@mcpherran.com> wrote: Regarding performance, I would hope that floating point (i.e. float, double) math operations in .NET will still use the math hardware in the CPU. I.e. the runtime layer, even though not native, will still access hardware facilities as needed?
It will certainly still do the operations in hardware - but whether the
JIT has long enough to work out whether it can parallelise operations
using SSE or the like is a different matter. I wouldn't like to
speculate on whether it does or not, but that's an area a static
compiler *might* get an advantage in. (That's not to say that any such
advantage will stay around forever, of course.)
--
Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Thank you. It will certainly still do the operations in hardware...
Isn't this another example of why the fuss about even native C++ performance
over C# is overrated. I.e. it still comes down to hardware for a lot of the
number crunching and graphics display.
--
Greg McPherran www.McPherran.com
"Jon Skeet [C# MVP]" wrote:
Greg <gm@mcpherran.com> wrote: Regarding performance, I would hope that floating point (i.e. float, double) math operations in .NET will still use the math hardware in the CPU. I.e. the runtime layer, even though not native, will still access hardware facilities as needed?
It will certainly still do the operations in hardware - but whether the JIT has long enough to work out whether it can parallelise operations using SSE or the like is a different matter. I wouldn't like to speculate on whether it does or not, but that's an area a static compiler *might* get an advantage in. (That's not to say that any such advantage will stay around forever, of course.)
-- Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet If replying to the group, please do not mail me too
Greg <gm@mcpherran.com> wrote: It will certainly still do the operations in hardware...
Isn't this another example of why the fuss about even native C++ performance over C# is overrated. I.e. it still comes down to hardware for a lot of the number crunching and graphics display.
Well, not entirely. If a native compiler can use parallelism in a way
that the JIT can't, the performance difference could be enormous. It's
unlikely to affect most applications, however.
--
Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Theorically speaking JITed software could even be faster because:
1. they are, after all, fully compiled (by the JIT) as well
2. the JIT could optimize the code for the current hardware.
It's not true because because some CPU/Memory hungry optimization are not
done by the JIT while they are done by the native compiler.
But, in fact, unoptimized native C++ could be much slower than C# code.
For reference look at that Article by Richard Grimes http://www.grimes.demon.co.uk/dotnet/man_unman.htm
--
Regards,
Lloyd Dupont
NovaMind development team
NovaMind Software
Mind Mapping Software
<www.nova-mind.com>
"Greg" <gm@mcpherran.com> wrote in message
news:65**********************************@microsof t.com... Thank you.
It will certainly still do the operations in hardware...
Isn't this another example of why the fuss about even native C++ performance over C# is overrated. I.e. it still comes down to hardware for a lot of the number crunching and graphics display.
-- Greg McPherran www.McPherran.com
"Jon Skeet [C# MVP]" wrote:
Greg <gm@mcpherran.com> wrote: > Regarding performance, I would hope that floating point (i.e. float, > double) > math operations in .NET will still use the math hardware in the CPU. > I.e. the > runtime layer, even though not native, will still access hardware > facilities > as needed?
It will certainly still do the operations in hardware - but whether the JIT has long enough to work out whether it can parallelise operations using SSE or the like is a different matter. I wouldn't like to speculate on whether it does or not, but that's an area a static compiler *might* get an advantage in. (That's not to say that any such advantage will stay around forever, of course.)
-- Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet If replying to the group, please do not mail me too
> > I have converted the managed C++ FFT routine over to C# and I have repeated the tests. These results show that the not optimised C# library is just slower than the not optimised C++ library, but the optimised C# is slightly faster than the optimised managed C++ library. The difference in the optimised librarys is very small. This reinforces the point in the article that the *runtime* does the optimizations, and that the optimizations provided by the .NET compilers are marginal.
Agreed.
Bingo! This tells me right here that for .NET there is no good reason to use
C++ if one is more productive in C#. Thank you will Richard and Willy.
Anyone can answer my question?
-- In C#, one can use
new Object [,] {{"name","=","Yuje"}, {"ID","=","1"}} to represent "where"
in SQL select, But what about in C++
Can we say
Object *obj[] ={{"name","=","Yuje"}, {"ID","=","1"}} ?
What was the corresponding of C++ to C# in this case.
--
Yuje Peng
Yuje Peng
"Greg" wrote: Is there a difference of opinion between C# users and C++ users as to whether C# is generally a replacement for C++? I asked this in the C++ thread and most people people who responded say that C# is not a replacement for C++.
Do C# promoters have a different view?
-- Greg McPherran www.McPherran.com This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: William C. White |
last post by:
Does anyone know of a way to use PHP /w Authorize.net AIM without using
cURL? Our website is hosted on a shared drive and the webhost company
doesn't installed additional software (such as cURL)...
|
by: Albert Ahtenberg |
last post by:
Hello,
I don't know if it is only me but I was sure that header("Location:url")
redirects the browser instantly to URL, or at least stops the execution of
the code. But appearantely it continues...
|
by: James |
last post by:
Hi,
I have a form with 2 fields.
'A'
'B'
The user completes one of the fields and the form is submitted.
On the results page I want to run a query, but this will change
subject to which...
|
by: Ollivier Robert |
last post by:
Hello,
I'm trying to link PHP with Oracle 9.2.0/OCI8 with gcc 3.2.3 on a Solaris9
system. The link succeeds but everytime I try to run php, I get a SEGV from
inside the libcnltsh.so library.
...
|
by: Richard Galli |
last post by:
I want viewers to compare state laws on a single subject.
Imagine a three-column table with a drop-down box on the top. A viewer
selects a state from the list, and that state's text fills the...
|
by: Albert Ahtenberg |
last post by:
Hello,
I have two questions.
1. When the user presses the back button and returns to a form he filled
the form is reseted. How do I leave there the values he inserted?
2. When the...
|
by: inderjit S Gabrie |
last post by:
Hi all
Here is the scenerio ...is it possibly to do this...
i am getting valid course dates output on to a web which i have designed
....all is okay so far , look at the following web url
...
|
by: Jack |
last post by:
Hi All,
What is the PHP equivilent of Oracle bind variables in a SQL statement, e.g.
select x from y where z=:parameter
Which in asp/jsp would be followed by some statements to bind a value...
|
by: Sandwick |
last post by:
I am trying to change the size of a drawing so they are all 3x3.
the script below is what i was trying to use to cut it in half ... I
get errors.
I can display the normal picture but not the...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |