Latest Activity In Study Groups

Join Your Study Groups

VU Past Papers, MCQs and More

We non-commercial site working hard since 2009 to facilitate learning Read More. We can't keep up without your support. Donate.

Generally, C# and Java can be just as fast or faster because the JIT compiler -- a compiler that compiles your IL the first time it's executed -- can make optimizations that a C++ compiled program cannot because it can query the machine. It can determine if the machine is Intel or AMD; Pentium 4, Core Solo, or Core Duo; or if supports SSE4, etc.
A C++ program has to be compiled beforehand usually with mixed optimizations so that it runs decently well on all machines, but is not optimized as much as it could be for a single configuration (i.e. processor, instruction set, other hardware).
Additionally certain language features allow the compiler in C# and Java to make assumptions about your code that allows it to optimize certain parts away that just aren't safe for the C/C++ compiler to do. When you have access to pointers there's a lot of optimizations that just aren't safe.
Also Java and C# can do heap allocations more efficiently than C++ because the layer of abstraction between the garbage collector and your code allows it to do all of its heap compression at once (a fairly expensive operation).
Now I can't speak for Java on this next point, but I know that C# for example will actually remove methods and method calls when it knows the body of the method is empty. And it will use this kind of logic throughout your code.
So as you can see, there are lots of reasons why certain C# or Java implementations will be faster.
Now this all said specific optimizations can be made in C++ that will blow away anything that you could do with C #, especially in the graphics realm and anytime you're close to the hardware. Pointers do wonders here.
So depending on what you're writing I would go with one or the other. But if you're writing something that isn't hardware dependent (driver, video game, etc), I wouldn't worry about the performance of C# (again can't speak about Java). It'll do just fine.

Views: 1639

Replies to This Discussion

v good

sab k answer ghalt hain :(

to pher aap ko idea dana chahiya

baki languages hum prn ga hi to pta chly ga na un m kya ha asy asy question kr dety hn yaar chwal sa

yes faisal is rite

C++ is one of the most accepted programming languages and is implemented on a wide variety of hardware and operating system platforms. As an efficient compiler to native code, its application domains include systems software, application software, device drivers, entertainment software embedded software, high-performance server and client applications, and embedded software. C++ has greatly influenced many other popular programming languages, most notably C# and Java and J# etc. In other words they are modified and simplified versions of C++ according to particular needs. As these languages barrow basic structure, libraries, operators, classes structure, syntax. C# is important for understanding C++ the same way as C++ is important for understanding C#. C++ is a statically typed free-from. Multi-paradim, compiled, general-purpose programming language. It is regarded as an intermediate-level language, as it comprises a combination of both high-level and low-level language features .Bjarne Stroustrup starting at Bell Labs it adds object oriented features, like classes, and other enhancements to the C. so I conclude my talk at this point that c++ is a foundation for the other languages and it help us in understanding the syntax of other languages like C# and java.

dont copy


© 2021   Created by + M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service