473,946 Members | 10,018 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

I wasn't expected that !

For a long time I was a gib fan of Borland C++ Builder with VCL framework and never gave a second look in Microsoft
products since I've seen MFC. Anyway, recently Borland decided out of the blue to abandon it's C++ Builder and I decided
to give a look into the .NET C++ and .NET C# products. After briefly playing with them I put them to test against each
other in some floating point tasks. The outcome might surprise you. It certainly surprised me !

See for yourself:

http://mywebpages.comcast.net/marche...nchmark_01.htm

Jack
Nov 17 '05 #1
35 2102
Marchel wrote:
For a long time I was a gib fan of Borland C++ Builder with VCL
framework and never gave a second look in Microsoft products since
I've seen MFC. Anyway, recently Borland decided out of the blue to
abandon it's C++ Builder and I decided to give a look into the .NET
C++ and .NET C# products. After briefly playing with them I put them
to test against each other in some floating point tasks. The outcome
might surprise you. It certainly surprised me !

See for yourself:

http://mywebpages.comcast.net/marche...nchmark_01.htm


R:\>cl -O2 -EHs -Op fpbench1.cpp
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.3077 for 80x86
Copyright (C) Microsoft Corporation 1984-2002. All rights reserved.

fpbench1.cpp
Microsoft (R) Incremental Linker Version 7.10.3077
Copyright (C) Microsoft Corporation. All rights reserved.

/out:fpbench1.ex e
fpbench1.obj

R:\>cl -O2 -EHs -Op fpbench2.cpp
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.3077 for 80x86
Copyright (C) Microsoft Corporation 1984-2002. All rights reserved.

fpbench2.cpp
Microsoft (R) Incremental Linker Version 7.10.3077
Copyright (C) Microsoft Corporation. All rights reserved.

/out:fpbench2.ex e
fpbench2.obj

R:\>fpbench1
10000000 3.1415927035898 0.250
20000000 3.1415926785905 0.500
30000000 3.1415926702568 0.735
40000000 3.1415926660896 0.984
50000000 3.1415926635893 1.250
60000000 3.1415926619226 1.485
70000000 3.1415926607317 1.734
80000000 3.1415926598387 1.984
90000000 3.1415926591444 2.235

R:\>fpbench2
10000000 3.1415927035898 0.250
20000000 3.1415926785905 0.500
30000000 3.1415926702568 0.750
40000000 3.1415926660896 1.000
50000000 3.1415926635893 1.234
60000000 3.1415926619226 1.500
70000000 3.1415926607317 1.735
80000000 3.1415926598387 2.000
90000000 3.1415926591444 2.250

This code appears to be very sensitive to the -Op "Improve floating point
consistency" option. In fact, when I compiled your two samples without -Op,
I got times of 0.000 reported for every case!

-cd
Nov 17 '05 #2
Marchel wrote:
See for yourself:

http://mywebpages.comcast.net/marche...nchmark_01.htm


Very interesting! But there are far more variables in choice of tools
than raw speed. Most Windows applications are not number-crunching but
spend all their time waiting for the user to do something.

Perhaps you should consider other features such as ease of use,
portability, etc. I'm not claiming that Borland would necessarily do
better - I just think your tests need a wider scope. And let's not
forget deterministic cleanup - vital for resources other than memory
IMV, and often memory, too.

It's a great pity that Borland are ditching the VCL. It has had years
to mature into an excellent library, whereas the .NET library is still,
IMHO, in it's infancy. How is old Anders these days, anyway?
Arnold the Aardvark
Nov 17 '05 #3
"Arnold the Aardvark" <no@way.com> wrote in message news:c0******** **********@news .demon.co.uk...
Very interesting! But there are far more variables in choice of tools
than raw speed. Most Windows applications are not number-crunching but
spend all their time waiting for the user to do something.

Perhaps you should consider other features such as ease of use,
portability, etc. I'm not claiming that Borland would necessarily do
better - I just think your tests need a wider scope. And let's not
forget deterministic cleanup - vital for resources other than memory
IMV, and often memory, too.

It's a great pity that Borland are ditching the VCL. It has had years
to mature into an excellent library, whereas the .NET library is still,
IMHO, in it's infancy. How is old Anders these days, anyway?
Arnold the Aardvark


I did not intended to test anything else, but speed. I agree with you, that there are many other resons to choose
particular language. In my personal experience, most of the engineers choose BASIC for small projects. The choice of the
particular language for ocassional programmers is often driven by their personal basic and very limited contact with the
programming world. I did the test mostly for myself but wanted to share my experience with others. In my case, you can
say, I have speed obsession :-)

JM
Nov 17 '05 #4
I normally don't run compiler from command line. Remeber, that this test is intended is for ocassional programmer that
is using IDE and is not familiar to all the internal "secrets" of the compiler. Quite frankly, lot's of prople who
ocassionally program, have no idea what "quad word" or "C calling convention" etc means and how particular settings they
relate to the peformance of the final product. IDE has a clear option to choose either "Debug" or "Release" version and
under release version it has "optimized for speed" setting. That is all one should need to know. If Microsoft compiler
has some other secrets beyond that, that is too bad for Microsoft.

The option -Op you mentioned is impossible to be changed in the standard version of the package (at least in IDE). It is
grayed out. Most of the occasional users of the C++ package don't have higher versions of the compiler simply because
such versions are too expensive and the cost is not justified for home or light use.

In you setting without -Op there must be something wrong with the clock measurement in the program. It is simply
impossible on a today PC even overclocked to 4GHZ to execute 4 floating point double size additions and two floting
point double size divisions 90,000,000 times under 0.001 second. That would make your PC some kind of supercomputer.

JM
Nov 17 '05 #5
Marchel wrote:
The option -Op you mentioned is impossible to be changed in the
standard version of the package (at least in IDE). It is grayed out.
Most of the occasional users of the C++ package don't have higher
versions of the compiler simply because such versions are too
expensive and the cost is not justified for home or light use.
You're doing these tests with the Standard Version? That's hardly a
relevant test for doing any kind of performance benchmarking, since that
compiler has no optimizer whatsoever, and all optimizer options specified in
the IDE or command line are simply ignored.

In you setting without -Op there must be something wrong with the
clock measurement in the program. It is simply impossible on a today
PC even overclocked to 4GHZ to execute 4 floating point double size
additions and two floting point double size divisions 90,000,000
times under 0.001 second. That would make your PC some kind of
supercomputer.


Actually, I think it means there's something wrong with the generated code
with -O2 but not -Op. I haven't had a chance to really look into it - the
benchmark cleary took about the same time as without -Op, so I'm guessing
that the calculation of elapsed time somehow got bunged up.

-cd
Nov 17 '05 #6
Comparing against standard version of VC++ compiler is useless because it
has no meaningful optimizations.

"Marchel" <ma*****@comcas t.net> wrote in message
news:uY******** ************@co mcast.com...
I normally don't run compiler from command line. Remeber, that this test is intended is for ocassional programmer that is using IDE and is not familiar to all the internal "secrets" of the compiler. Quite frankly, lot's of prople who ocassionally program, have no idea what "quad word" or "C calling convention" etc means and how particular settings they relate to the peformance of the final product. IDE has a clear option to choose either "Debug" or "Release" version and under release version it has "optimized for speed" setting. That is all one should need to know. If Microsoft compiler has some other secrets beyond that, that is too bad for Microsoft.

The option -Op you mentioned is impossible to be changed in the standard version of the package (at least in IDE). It is grayed out. Most of the occasional users of the C++ package don't have higher versions of the compiler simply because such versions are too expensive and the cost is not justified for home or light use.
In you setting without -Op there must be something wrong with the clock measurement in the program. It is simply impossible on a today PC even overclocked to 4GHZ to execute 4 floating point double size additions and two floting point double size divisions 90,000,000 times under 0.001 second. That would make your PC some kind of supercomputer.
JM


Nov 17 '05 #7
>
The option -Op you mentioned is impossible to be changed in the standard version of the package (at least in IDE). It is
grayed out. Most of the occasional users of the C++ package don't have higher versions of the compiler simply because
such versions are too expensive and the cost is not justified for home or light use.


The standard version has no optimizer as Carl Daniel pointed out and
Microsoft point out http://msdn.microsoft.com/visualc/ho.../choosing.aspx

You should ammend your benchmark results to say that you used the
Standard version.

--
sashan
http://www.cs.auckland.ac.nz/~sgov008/

Nov 17 '05 #8
> You're doing these tests with the Standard Version? That's hardly a
relevant test for doing any kind of performance benchmarking, since that
compiler has no optimizer whatsoever, and all optimizer options specified in
the IDE or command line are simply ignored.
As I said, it's too bad for Microsoft. I'm not a professional programmer and I cannot, as many engineers and scientists
in similar to mine position, justify cost of more expensive versions of the software. I mentioned that clearly in the
test page.

Consider this for example:

(www.borland.com)
Borland C++ Builder 6.0 (Personal) $69
Borland C++ Builder 6.0 (Professional) $999
Borland C++ Builder 6.0 (Enterprise) $2999

(www.microsoft.com)
Microsoft Visual C++ .NET (Standard) $109
Microsoft Visual C++ .NET (Professional) $1079

In fact you can download complete, full version of the Borland compiler (without IDE) for free. Also you can get open
source (gcc) C++ windows compiler freely. This make the price span even more ridiculous. I'm refusing to buy expensive
versions of the software for occasional programming sessions. My money making job has nothing to do with computer
programming.
In you setting without -Op there must be something wrong with the
clock measurement in the program. It is simply impossible on a today
PC even overclocked to 4GHZ to execute 4 floating point double size
additions and two floting point double size divisions 90,000,000
times under 0.001 second. That would make your PC some kind of
supercomputer.


Actually, I think it means there's something wrong with the generated code
with -O2 but not -Op. I haven't had a chance to really look into it - the
benchmark cleary took about the same time as without -Op, so I'm guessing
that the calculation of elapsed time somehow got bunged up.


And that makes sense. On my Athlon XP 1800 + (similarly to your timing) 90,000,000 loops of four additions and two
divisions took roughly 2 seconds. For the sake of simplicity assuming that addition and division takes the same time, it
means six general math operations per loop, which means about 540,000,000 math operations in two seconds or 270,000,000
operations per second. Athlon XP 1800+ runs at 1533 MHz. So in fact it made each operation in about 5.7 clock cycle
which is pretty good. You can't massively improve this. That is why the differences between Borland, C# and VC++ were
not that big. All those compilers are in fact pretty good.


-cd


JM
Nov 17 '05 #9
To answer your reservations:

I seriously doubt that optimization will help in this particular test. The floating point math is done in FPU by
hardware. It will probably help with controversy of running the different style of coding almost twice as fast as the
other style of coding which I still consider ridiculous. I dont own a professional version of any compilers that I
tested.

I did mentioned, that the versions of all three compilers used in the test is the most stripped down, cheapest version
available on the market. It is mentioned in the section "2. Operating system and languages choice." of my test.

JM
Nov 17 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
2225
by: 2L | last post by:
Trying to write some code and this is just shitting me now! Bit of form validation stuff.... Variable is declared as follows..... --snip-- <script language="JavaScript"> <!---
5
5227
by: andy.herrera | last post by:
I'm getting this Error Message. Expected ';' Please Select One: <form name="form1"> <<------------ Error is here. <select name="selectTrans" onChange="If (this.value == 'checkout') window.location.href='CheckOut.php';"> <option>---Please Select One ---</option> <option value="checkout">Check OUT</option> <option value="checkin">Check IN</option> </select>
3
1283
by: Marchel | last post by:
For a long time I was a gib fan of Borland C++ Builder with VCL framework and never gave a second look in Microsoft products since I've seen MFC. Anyway, recently Borland decided out of the blue to abandon it's C++ Builder and I decided to give a look into the .NET C++ and .NET C# products. After briefly playing with them I put them to test against each other in some floating point tasks. The outcome might surprise you. It certainly surprised...
3
3207
by: Jon | last post by:
I'm learning about datatables. When using the example provided by MS in the ..NET Framework Class Library for DATATABLE (see below) I get an error on line 3 that says "Type expected". Is something missing from the code? Thanks - Jon Private Sub MakeParentTable() ' Create a new DataTable. Dim myDataTable As Datatable = New Datatable("ParentTable")
9
2283
by: rhaazy | last post by:
Using MS SQL 2000 I have a stored procedure that processes an XML file generated from an Audit program. The XML looks somewhat like this: <ComputerScan> <scanheader> <ScanDate>somedate&time</ScanDate>
7
92210
by: Warrax | last post by:
I am currently doing online tutorials for C++, and am pretty much stuck in a rut about this problem. It is saying that there's an expected unqualifed-id before '{' token (I will post the code in just a second) on line 11, and an expected ',' or ';' before '{' token also on line 11, however I don't have a clue what the first one means. The program is meant to save a user's name in a string variable within a structure, and to then show that name...
10
15796
by: preeya | last post by:
Hi, I have written the following program: ------------------------------------------------------------------------------------------------------------- 1 #include <stdio.h> 2 #include "abc.h" 3 4 void PROP_abc(double ptr)
0
10126
by: =?Utf-8?B?ZWdzZGFy?= | last post by:
Hi, I have created a second gridview when customer clicks on select link with this code: Protected Sub GridView1_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles GridView1.RowCommand Select Case e.CommandName
9
27670
by: erictheone | last post by:
Ok so what I'm trying to do is create a trans location cipher. For those among us that don't know alot about cryptography it is a method for jumbling up letters to disguise linguistic patterns(words). What it does is takes a string as a parameter, determines length of string, tests if the length is a perfect square, if it is then it makes a 2-d array with its length and height equal to the lengths root. If it isn't then it cuts it down to...
0
10150
marktang
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9976
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11554
Oralloy
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
11143
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9875
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8241
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6320
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4526
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3528
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.