Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Performance impact over something like that? If that sort of thing is really an issue, then you'd be best doing the whole thing in assembly.
-
@AlmondSauce my thoughts exactly. I have been in such situation a couple of times, and it sounds so ridiculous but still you have to prove it doesn't mean anything.
-
You're right, it's easy to fall into that trap.
The best code I write is usually the second or third fresh attempt. It lets me reconsider everything without the assumptions and limitations of the old code, I understand better where the ugly parts of the problem pop up and the uninteresting parts can often be copy-pasted from the previous iteration with minor modifications.
Keep it simple and flexible. In many cases the compiler/runtime will completely remove a lot of abstractions anyway and can detect possible optimisations in a couple milliseconds. If you think more than a few milliseconds about the number or structure of function arguments you're probably thinking about the wrong thing. -
What performance impact? You're allocating a class. Depending on the language now you're probably passing a reference to the object rather than copying all the primitives.
And usability >>> performance most of the time. -
@rolexpo all cases were in Java and if you introduce such structure there is a new object, hence additional memory has to be allocated. Nothing significant though. It's all bullshit.
-
Simple. use reflection. Everywhere. For everything.
no more performance, no more problem. -
@puradawid
I see I see. What in saying is that if you make a class, it will allocate this in the heap. And now you're modifying 1 memory object instead pass by value multiple times unless you're making new objects and what not.
Anyways, the person who brought up performance is an idiot. A method that had 7 variables definitely need a class. -
Guilty! I used to forward declare my functions like that in C (just because I could).
-
petru7434yIf you have that many parameters you have a design issue not a clean code issue. Yes defining an extra pojo is a simple fix but doesn't fix underlying problems.
-
Root797344yI would ask those same questions to make sure you benchmark your changes (and continue to do so on your own), not because I think it’s a performance concern. Also, performance still matters, especially in some areas. For example, in bulk processing at work, even a small change can add half an hour to the processing time.
-
hjk10156964yUsually there is no performance impact at all unless there is some bs cost in dereferencing a value or very costly object instantiation going on. Even in PHP the object is passed as a ref (unless it's values are modified and you probably shouldn't).
Related Rants
I get angry every fucking time when I see such method signature:
method(int, int, int, string, string, string, string)
Sounds scary, doesn't it?
Nah. That's the reason our IDEs are so complex. So, I change this and put proper data value/struct class instead, just to make this much readable and understandable for everyone.
And, every time there is a fella that asks this utterly stupid question:
What about performance impact?
Aaaaaaaaaaaaaa fuckyutitititiigig
And. I. Have. To. Run. Performance. Tests.
Because noone understands performance and computers so I have to prove there is nothing to worry about.
I know when I will go somewhere else I will have to again prove some fuckwit that web applications are so complex already, so adding a new data structure doesn't impact its performance.
rant
performance
constructor
data