|
Yes, BTW you should acknowledge the signature's author giving him, for instance, a new laptop.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi all,
I am placing a Bitmap on a DialogBox, when i change the display settings than the dialog box resize according to display settings, and image not.
so i want to resize image too when the dialog box resize.
Please help me for this.
thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
Like this [^]?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I am using CArray in my application's calculation routine in many places.
When running the calculation its getting slow. How to overcome this?
|
|
|
|
|
how are you using it ?
and how do you mesure the performance impact ?
|
|
|
|
|
.....
CArray<double,double> y;
y.Add(dArea);
.....
modified on Tuesday, October 21, 2008 8:24 AM
|
|
|
|
|
I think I see your problem: The Add method of CArray will grow the array by 1. To grow, the WHOLE array is copied to a larger buffer in memory.
So if you add n elements, you're actually doing n squared operations. This is sometimes called the Schlemiel Algorithm http://en.wikipedia.org/wiki/Schlemiel_the_painter's_Algorithm[^]
If you pre-allocate the whole array, it may speed up your processing significantly.
|
|
|
|
|
....
CArray<double,> MyArray;
MyArray.SetSize(20, 10); //Initial size 20 and grow by 10
MyArray.SetAt(0, 10.0);
MyArray.SetAt(1, 20.0);
MyArray.SetAt(2, 30.0);
MyArray.SetAt(3, 40.0);
.....
.....
This will speed up the process?
|
|
|
|
|
A little. Ideally you would allocate the maximum size you'll need, and avoid doing any growing.
Of course the slowness could be due to another cause, but this could be the reason.
|
|
|
|
|
I will try it by allocating maximum size.
Thanks.
|
|
|
|
|
Are you re-allocating (or resizing ) the array ?
This signature was proudly tested on animals.
|
|
|
|
|
|
RSAK wrote: I am using CArray in my application's calculation routine in many places.
When running the calculation its getting slow. How to overcome this?
You have to speed up your calculation algorithm.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I am sure that calculation will not take much time.
|
|
|
|
|
OK. I'm sure the CArray , properly used, is a efficient container.
Now, if both of us are right, your application has an intrinsic, insurmountable speed limit.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
After any allocation and filling of the array, you could use the member function GetData () to get at the actual doubles - then you can treat them as a double * , or classic C array.
If *that* is still slow, then the problem is not CArray.
As I'm fairly sure that the [] operator of CArray is an inline, you're probably already as fast as you'll get.
Iain.
|
|
|
|
|
|
Supriya Tonape wrote: Any pointers are appreciated.
Sure, why not. That's what we do here at CodeProject we supply Google Search's[^] for those who can't do it themselves.
led mike
|
|
|
|
|
how to Create,copy,remove,delete the folder using in mfc code.
am using a msdos command in mfc ,its wrking but appear a command prompt window.
|
|
|
|
|
com'on man... see mkdir function in MSDN help.. it will give a clue.
|
|
|
|
|
thanx for replay,
yes am using the same concept(mkdir,xcopy,rmdir) but the command prompt is appear in my application . i want to hide the prompt window how.
|
|
|
|
|
mathy wrote: yes am using the same concept(mkdir,xcopy,rmdir)...
But why? Those are old, command prompt operations. Use the Win32 API for such tasks. See here.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Also look for SHFileOperation .
Moving / deleting a directory is more work than you probably think.
There are articles using the API here on codeproject, and some msdn articles too.
Iain,
|
|
|
|
|
thanx,
if u able to give any sample code to this for any one.
|
|
|
|
|
Nope, not able. I will point you to the search box at the top of the forum, as this is not the first time this question has been asked in october...
Iain.
|
|
|
|