Just an observation for some code I'm writing, but in a bid to optimise it and make it as quick and lightweight as possible, I noticed that 8 lines of Clarion code was taking 8 milliseconds and its not even overloaded with functions, just some basic, If, and maths functions.
It makes me wonder just how much slower OOP classes makes things, when taking into account the procedure/method overheads.
Obviously 8 lines could take a few billionths of a second, or a few seconds. It all depends onwhat they do.
Also, since the computer is doing multiple thi gs at the same time, an absolute measure in time terms has a high margin of error.
The more ideal measure is using a profiler, which can then measure clock cycles etc.
But to answer your question- yes a method call for a virtual method makes an extra jump. Whether that is material or not depends on the actual code. In most cases it is not significant in the overall cost of the process.
Or application, if its a desktop app with user interaction, then probably not material, but if a service, running all the time, then probably best to minimise the cpu time as much as possible.
CPU also plays a part, if it doesnt have a fast clock speed or if its missing instructions sets so windows has to plug the gap with the general register which is slower, then optimising code makes for an interesting task and alters the way one programs code.
I can see why there is still a demand for C/C++ programmers and assembler programmers.
Without seeing the code, it’s impossible to say. It’s kind of like asking how long a 2x4" is without any further qualification. Clarion code is generally very fast and I recently was testing some string parsing using 1,000,000 iterations of the code and it showed the block of code taking 2-3 microseconds to execute for each iteration. I don’t recall the exact specifics of the code, but as I recall it was about 20 lines of code in the block being executed, running on previously randomly generated strings. A millisecond per line sounds very slow, but without knowing what the code is doing, it’s impossible to say.
You haven’t said what you’re writing, possibly it’s a service of some form
but if you’re really worried about performance
then consider having no windows at all
It all depends on what you’re trying to accomplish
and what tools you’re using to accomplish it
For the most part calling a method just means adding self as the first parameter
there should be no discernable performance difference
oftentimes the more important performance difference is coding time vs. running time. IMO Clarity and quality of code should not be sacrificed for most performance moves. Of course there are always exceptions to rules, but please think hard about what is really important.
Because that’s what RichR does, long descriptions but no code. Hard to answer.
Nobody responding has asked how the Timing of 8 or 11 Milliseconds was done in code?
That’s inside the minimum resolution of GetTickCount() and Clock(). So can an interval that small be significant to consider?
The resolution of GetTickCount is typically in the range of 10 milliseconds to 16 milliseconds on Windows systems. This means that the value returned by GetTickCount will only update at these intervals, even if the underlying system timer is firing more frequently due to calls like timeBeginPeriod.