You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
In the second case there is indirect access via reference, which in a microscopic loop body naturally takes half the time, doubling it.
I think this is just an optimization of the first case of direct access to an object member.
In the second case we have indirect access via reference which naturally takes half of the time with a microscopic loop body increasing it twofold.
Renat, in the real world there are large arrays of data being processed. I have already simplified the test, just to show the problem area. Initially I created it using my own arrays and classes. Then I reduced it to a scheme.
i.e. we don't actually have just one arr object, but an array of complex objects (also with arrays).
roughly this can be written in the scheme as
I reasoned that if I get a reference to a particular array element A
The work with parameters A::prmX will be faster.
But it turned out that pulling a sausage out of array names
_b[i]._a[j].prmX
would be at least twice as fast as referring to a particular item.
I was a bit surprised by this, and it's clear that the kernel is getting some kind of pseudo-pointer.
Is there any way to optimize the speed, which at least reduces the difference in speed?
this is how it will be without errors
There will be no error in this way in this test. But this method does not solve the main question: why does the compiler skip transformation of a constant object reference to a non-const reference and generate no error and/or warning? If it is such a feature, no questions, but in this case the meaning of the modifier const for the returned type in the signature of class methods is lost.
everything makes sense to me.
The constant object functions should not change the object itself, so they should also have a const modifier
and about
//Ошибки нет. Это НЕ правильно(CONST A* B::getA())! A* a2 = b.getA();
well, yes, that won't work in C++.
Write to servicedesk.
But it turns out that pulling a sausage out of array names
will be at least twice as fast as accessing a specific item.
Is it really faster or is it a logical construction of the output based on other simpler cases?
In my opinion, a clean proof based on the presented access to a multidimensional array has not been presented yet. Especially given the presence of the frankly expensive additional function GetPointer.
It surprised me a bit, and it became clear that there is some kind of pseudo-indexing going on in the kernel.
Is there any way to optimize the speed, which would at least reduce the speed difference?
We are constantly working on optimisation, but in the case of references/handles there is a system overhead on indirect access.
Anyway, let's look more closely into optimization of such access.
Is it really faster or is it a logical construction of the conclusion based on other simpler cases?
yes, it's quite realistic. i've tested it on filling my arrays. it's always been twice as slow.
To my mind, a clean proof based on the presented multidimensional array access has not yet been presented.
Well, I've laid out the scheme and an image of classes A, B and arrays.
Especially with the frankly expensive additional function GetPointer.
it is called once before entering a loop. but in principle, for a more accurate test, you can also take it outside of GetTickCount
OK. Thanks. That's exactly what we need.
it is called once before entering the loop. but in principle, for a more accurate test, you could also take it outside of GetTickCount
A suggestion. Can the text zoom feature be included in the help. e.g. + or - , or Ctrl+mouse wheel.
It's probably not possible. Isn't the online version suitable?
Here's what I found on the internet on the subject - http://forum.ru-board.com/topic.cgi?forum=62&topic=20907
UPDate More http://forum.ixbt.com/topic.cgi?id=23:39211