OO is slow..... or is it? |
| |
 |
Reputation Power: 17

| | Code Guru Gender:  Posts: 1403 Topics: 86  |
|
|
April 08, 2009, 02:41:24 AM
|
I haven't posted this in a specific language part, because I think it applies in a way to all languages.
My argument is - an OO language requires more resources to create, manage, delete and communicate objects, so surely by their nature they are slower than none OO languages? Having said that, does programming OO style force the the programmer to write "better" code, which in turn promotes efficiency?
I have certainly seen with Java, a massive speed increase (and memory footprint drop) was obtained by reimplementing the default serialization and deserialization .
|
|
|
|
| |
 |
Reputation Power: 17

| | Code Guru Gender:  Posts: 1403 Topics: 86  |
|
|
April 08, 2009, 02:42:03 AM
|
I would be tempted to say yes, OO is generally slower - but not by a huge amount and it doesn't really matter for the majority of applications
|
|
| |
 |
Reputation Power: 19

| | Code Guru Location: India
Gender:  Posts: 1444 Topics: 126  |
|
|
April 09, 2009, 03:25:45 AM
|
I agree to the fact that OO requires more resources as OO based programs contain arrays, objects, matrix, more variables etc etc. and for that it require resources.
In early years I think when OO was new in the market, the programmers might have faced the slow running programs because at that time the hardware was not that much good (low memory RAM etc.), and yes that might have forced the programmer to write better code to utilize as low as low resources.
But as the Hardware are upgraded with new and better ones, the speed issue is solved. for e.g. a complex .net programs can run with better speed on latest machines with say 1GB or 2GB of RAM.
So I would say OO was slow but not now because of Latest upgraded and better hardware.
Help us to keep this forum clean. Report the SPAM!
|
|
| |
 |
Reputation Power: 17

| | Code Guru Gender:  Posts: 1403 Topics: 86  |
|
|
April 09, 2009, 04:44:23 AM
|
I agree to the fact that OO requires more resources as OO based programs contain arrays, objects, matrix, more variables etc etc. and for that it require resources.
No, imperative languages (for instance C) have arrays built in (which are nothing to do with OO.) It is very possible to represent matrixes, lists and even objects in these languages (and we do), but the OO abstraction arguably makes the programmer's job easier.... at the cost that the compiler must do more work. Important to efficiency, there is overhead such as creating, tracking, destroying objects and passing messages between them.... that is why there may be a performance hit. It is a common argument (and I think misconception) that as hardware gets better programs get faster. Better hardware does help hide poorly efficient code, but there are many applications (games, video editing) when even with great hardware these things are slow... also with better hardware often user expectations are higher, with them wanting to run more (more resource hungry) programs at once. I do think as time has progressed compiler technology has helped make OO more efficient, but by its very nature how far can it go....
|
|
| |
 |
Reputation Power: 19

| | Code Guru Location: India
Gender:  Posts: 1444 Topics: 126  |
|
|
April 09, 2009, 05:37:22 AM
|
that makes sense
Help us to keep this forum clean. Report the SPAM!
|
|
| |
 |
Formerly theone759. Reputation Power: 6

| | Professional Coder Posts: 348 Topics: 52 |
|
|
April 10, 2009, 10:39:03 AM
|
I would be tempted to say yes, OO is generally slower - but not by a huge amount and it doesn't really matter for the majority of applications
Hehe, did you just reply to your own thread? What is an OO language?
|
|
| |
 |
Reputation Power: 17

| | Code Guru Gender:  Posts: 1403 Topics: 86  |
|
|
April 14, 2009, 02:20:11 AM
|
Hehe, did you just reply to your own thread?
Yup  What is an OO language?
OO stands for Object Orientated - it is a programming paradigm. I could spend ages explaining it, but Wikipedia has quite a good article about it http://en.wikipedia.org/wiki/Object-oriented_programming_language
|
|
| |
 |
Reputation Power: 17

| | Code Guru Gender:  Posts: 1403 Topics: 86  |
|
|
April 14, 2009, 02:25:42 AM
|
I am going to reply to my thread again!
The reason I posted this post in the first place is that I feel, quite often, programmers have their own set of favoured tools (and abstractions) to use. I wouldn't call OO a new concept by any means, but I do feel that some programmers who code (almost) entirely in this model look down on programmers who might use other models (such as imperative, functional etc) believing they are wrong or out dated. A good real world example of this is that I have seen so many times people argue C++ is "better" than C just because C++ is Object Orientated.
I believe that this is all completely wrong, languages are like tools and some suit some problems and others other ones. Yes, lots of us have our own favourite [set of] language but it is important to appreciate that our way is not the only way and (often) other's ways are just as valid.
|
|
| |
 |
Reputation Power: 1

| | Regular Coder Posts: 53 Topics: 2 |
|
|
August 03, 2009, 08:51:40 PM
|
Java isn't slow because it's OO, Java is slow because it's Java and is basically an interpreted language and not a compiled one. C++ is slightly slower than C, but I think that's attributed to many of the other features of the language creating a more difficult job for the compiler. One day, the C++ compiler may be just as optimized as the C compiler and then there won't be a difference.
|
|
| |
 |
Reputation Power: 17

| | Code Guru Gender:  Posts: 1403 Topics: 86  |
|
|
August 04, 2009, 04:06:15 AM
|
Java is slow because it's Java and is basically an interpreted language and not a compiled one.
C++ is slightly slower than C
Another thread entirely! But I bet I could find lots and lots of webpages and experiments that completely disagree with those two statements! Not that I entirely disagree, just that I think performance is a far more complicated issue which can not be generalised as easily as we may like. However, I don't care about the languages, just the paradigm...... my concern is that an OO language has quite a overhead dealing its own OO issues if not carefully delt with - I have seen HPC Java programs speed up imensly by the programmers reimplementing certain OO functions, but this only helps in some cases.... However, on the flip side, in a language such as C where the programmer must manipulate and maintain "objects" without the OO abstraction, then there is an argument that some (or may) programmers might produce poor code which an OO language's compiler could have easily bettered.
« Last Edit: August 04, 2009, 04:23:17 AM by polas »
|
|
| |
 |
Reputation Power: 1

| | Regular Coder Posts: 53 Topics: 2 |
|
|
August 04, 2009, 07:20:10 AM
|
I think it's all up to how the code is written. You can have a C program run slower than a Java program that does the same thing if it's written so poorly that it would make Donald Knuth's eyes bleed. And I'm sure there are ways to make Java scoot a lot faster, but a programmer shouldn't have to tweak a language to get it to work the way they need it to. Now, if you have two pieces of code, both expertly written in different languages, one of them OO and one of them not, I think that the OO one would lose in a race if even by the slightest margin because there's more likely to be some kind of extra overhead. OO cuts down on programmer time, not program time. But I wouldn't call the paradigm slow, though my professors often call it a fad.
|
|
| |
 |
Reputation Power: 17

| | Code Guru Gender:  Posts: 1403 Topics: 86  |
|
|
August 04, 2009, 07:24:19 AM
|
Some very good points - I suppose programmer time is often the most important factor. Your comment about your professors calling OO a fad made me laugh - did you know that, unlike imperative and functional paradigms, we do not have a semantic definition/model for OO and as such do not have an agreed formal mathematical definition, although of course there are unformal ones.
|
|
| |
 |
Reputation Power: 1

| | New Poster Posts: 14 Topics: 3 |
|
|
September 03, 2009, 10:31:43 AM
|
OO generally os more efficient in the long run because you tend to write dryer code (if you're doing it right).
|
|
| |
 |
Reputation Power: 1

| | New Poster Posts: 13 Topics: 1 |
|
|
October 31, 2010, 11:59:06 PM
|
no it is not slow
« Last Edit: March 09, 2011, 04:15:54 AM by Admin »
|
|
| |
 |
Reputation Power: 1

| | New Coder Posts: 25 Topics: 0 |
|
|
January 23, 2011, 05:45:22 PM
|
did you know that, unlike imperative and functional paradigms, we do not have a semantic definition/model for OO and as such do not have an agreed formal mathematical definition, although of course there are unformal ones.
|
|
| |
 |
Reputation Power: 1

| | New Coder Posts: 18 Topics: 0 |
|
|
August 04, 2011, 02:13:13 AM
|
no it is not so important
|
|
| |
 |
Reputation Power: 3

| | Professional Coder Posts: 227 Topics: 7 |
|
|
August 05, 2011, 03:13:47 AM
|
I think yes oop is slow than the procedural language.
|
|
| |
 |
Life Is Good! Reputation Power: 3

| | Professional Coder Gender:  Posts: 241 Topics: 3  |
|
|
August 24, 2011, 08:53:54 AM
|
no it does not slow down your program.. on the other hand, it makes it faster.. this, of course, is true if you are a good programmer..
|
|
| |