Home » Community » U++ community news and announcements » String::Cat optimization
Re: String::Cat optimization [message #34604 is a reply to message #34595] |
Thu, 01 December 2011 17:52 |
|
mirek
Messages: 13980 Registered: November 2005
|
Ultimate Member |
|
|
Tom1 wrote on Thu, 01 December 2011 08:50 | Hi,
I played around with Mirek's idea awhile and according to my simple '::GetTickCount()' benchmarking on MSC9/Win7x64 I managed to squeeze yet more performance out of it. The test covered all transfer lengths from 1 to 16 bytes.
The svo_memcpy() suffers a performance penalty at len==16, where secondary function call to memcpy steps in. The following macro approach helps dramatically to reduce that penalty. I also discovered that the memcpy() performance might not be reached systematically at transfer lengths above 11 bytes, so limiting the switch to <= 11 bytes should improve overall performance.
inline void memcpy11i(char *t, const char *s, int len){
switch(len) {
case 11: t[10] = s[10];
case 10: t[9] = s[9];
case 9: t[8] = s[8];
case 8: t[7] = s[7];
case 7: t[6] = s[6];
case 6: t[5] = s[5];
case 5: t[4] = s[4];
case 4: t[3] = s[3];
case 3: t[2] = s[2];
case 2: t[1] = s[1];
case 1: t[0] = s[0];
}
}
#define memcpy11(t, s, len) (len)>11 ? memcpy(t, s, len) : memcpy11i(t, s, len)
How does this perform on your systems?
Best regards,
Tom
|
Well, that is actually even better, as MSC refuses to inline that function....
Mirek
|
|
|
|
|
String::Cat optimization
By: mirek on Wed, 30 November 2011 17:58
|
|
|
Re: String::Cat optimization
By: koldo on Wed, 30 November 2011 18:11
|
|
|
Re: String::Cat optimization
|
|
|
Re: String::Cat optimization
By: mirek on Wed, 30 November 2011 21:15
|
|
|
Re: String::Cat optimization
By: koldo on Thu, 01 December 2011 06:18
|
|
|
Re: String::Cat optimization
By: mirek on Thu, 01 December 2011 08:04
|
|
|
Re: String::Cat optimization
By: koldo on Thu, 01 December 2011 08:39
|
|
|
Re: String::Cat optimization
|
|
|
Re: String::Cat optimization
By: mirek on Thu, 01 December 2011 11:37
|
|
|
Re: String::Cat optimization
|
|
|
Re: String::Cat optimization
By: Tom1 on Thu, 01 December 2011 14:50
|
|
|
Re: String::Cat optimization
By: mirek on Thu, 01 December 2011 17:52
|
|
|
Re: String::Cat optimization
By: mirek on Thu, 01 December 2011 20:41
|
|
|
Re: String::Cat optimization
By: Lance on Fri, 02 December 2011 03:59
|
|
|
Re: String::Cat optimization
By: mirek on Fri, 02 December 2011 06:39
|
|
|
Re: String::Cat optimization
By: Novo on Fri, 02 December 2011 06:02
|
|
|
Re: String::Cat optimization
By: mirek on Fri, 02 December 2011 06:40
|
|
|
Re: String::Cat optimization
By: Novo on Fri, 02 December 2011 18:50
|
|
|
Re: String::Cat optimization
By: mirek on Fri, 02 December 2011 19:06
|
|
|
Re: String::Cat optimization
By: Tom1 on Fri, 02 December 2011 10:22
|
|
|
Re: String::Cat optimization
By: mirek on Fri, 02 December 2011 11:10
|
|
|
Re: String::Cat optimization
By: mirek on Wed, 16 May 2012 15:30
|
|
|
Re: String::Cat optimization
By: unodgs on Thu, 01 December 2011 14:38
|
|
|
Re: String::Cat optimization
By: Tom1 on Thu, 01 December 2011 14:54
|
|
|
Re: String::Cat optimization
By: mirek on Thu, 01 December 2011 17:51
|
Goto Forum:
Current Time: Thu May 23 11:34:26 CEST 2024
Total time taken to generate the page: 0.02079 seconds
|