login about faq

C++ project, why CkString so slow?

Example:

DWORD bingotestBe = GetTickCount ();

for (int i = 0; i <100000; i + +)
{
CkString cks;
cks.setStringU (_T ("Hello world"));
cks.appendU (_T ("!!!"));
cks.clear ();
}
DWORD bingotestEn = GetTickCount () - bingotestBe;
cout << "ck:" << bingotestEn << endl;

bingotestBe = GetTickCount ();
for (int i = 0; i <100000; i + +)
{
wstring str;
str = _T ("Hello world");
str + = _T ("!!!");
str.clear ();
}
bingotestEn = GetTickCount () - bingotestBe;
cout << "std:" << bingotestEn << endl;
Results:

ck: 10344

std: 94

How to improve the speed of your product?

asked Dec 21 '12 at 20:47

bingo's gravatar image

bingo
1334

edited Dec 24 '12 at 08:57

chilkat's gravatar image

chilkat ♦♦
11.8k316358421


The slowness is due to the CkString constructor. If the object is moved outside the loop, then performance should improve significantly.

In any case, Chilkat has addressed this problem internally and can provide a new build (v4.7.1 pre-release) that greatly improves the performance, even if the CkString object is kept inside the loop. Please let me know what version of VC++ you use, or if using a non-Windows OS, which operating system (and if it's 32-bit or 64-bit).

link

answered Dec 24 '12 at 08:59

chilkat's gravatar image

chilkat ♦♦
11.8k316358421

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×65
×11
×6
×1

Asked: Dec 21 '12 at 20:47

Seen: 1,512 times

Last updated: Dec 24 '12 at 08:59

powered by OSQA