Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » U++ community news and announcements » String::Cat optimization
Re: String::Cat optimization [message #34622 is a reply to message #34608] Fri, 02 December 2011 10:22 Go to previous messageGo to next message
Tom1
Messages: 1212
Registered: March 2007
Senior Contributor
OK, this was fun!

Just makes me wonder if there could be wider visibility for this optimization. I can imagine memcpy() is used all over the code, and short blocks are not that uncommon. Maybe Core could hold this SVO_MEMCPY macro in a header included via Core.h so that any code can access it?

Best regards,

Tom
Re: String::Cat optimization [message #34623 is a reply to message #34622] Fri, 02 December 2011 11:10 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13976
Registered: November 2005
Ultimate Member
Tom1 wrote on Fri, 02 December 2011 04:22

OK, this was fun!

Just makes me wonder if there could be wider visibility for this optimization. I can imagine memcpy() is used all over the code, and short blocks are not that uncommon. Maybe Core could hold this SVO_MEMCPY macro in a header included via Core.h so that any code can access it?

Best regards,

Tom



Maybe, but I am afraid it would take some time to figure out what to convert to svo_memcpy and what not. Not all cases are suitable.

For now I will just file new RM#:

http://www.ultimatepp.org/redmine/issues/204
Re: String::Cat optimization [message #34636 is a reply to message #34615] Fri, 02 December 2011 18:50 Go to previous messageGo to next message
Novo is currently offline  Novo
Messages: 1358
Registered: December 2006
Ultimate Contributor
mirek wrote on Fri, 02 December 2011 00:40

Novo wrote on Fri, 02 December 2011 00:02

mirek wrote on Thu, 01 December 2011 14:41


Thanks, this is even better. Somehow I forgot that if compiler decides not to inline something, I can still force it by macro.



There is an easier way to force inlining:

MSVC - __forceinline
GCC - __attribute__((always_inline))


Is it really easier? Smile

Mirek


Make one define (something like FORCE_INLINE) and put it in front of any function you want to make inline. This is it. You do not need to deal with hundreds of back-slashes.


Regards,
Novo
Re: String::Cat optimization [message #34637 is a reply to message #34636] Fri, 02 December 2011 19:06 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13976
Registered: November 2005
Ultimate Member
Novo wrote on Fri, 02 December 2011 12:50

mirek wrote on Fri, 02 December 2011 00:40

Novo wrote on Fri, 02 December 2011 00:02

mirek wrote on Thu, 01 December 2011 14:41


Thanks, this is even better. Somehow I forgot that if compiler decides not to inline something, I can still force it by macro.



There is an easier way to force inlining:

MSVC - __forceinline
GCC - __attribute__((always_inline))


Is it really easier? Smile

Mirek


Make one define (something like FORCE_INLINE) and put it in front of any function you want to make inline. This is it. You do not need to deal with hundreds of back-slashes.


Actually, I already did, see 'strlen optimization' thread... Smile
Re: String::Cat optimization [message #36248 is a reply to message #34623] Wed, 16 May 2012 15:30 Go to previous message
mirek is currently offline  mirek
Messages: 13976
Registered: November 2005
Ultimate Member
Moved SVO_MEMCPY to defs.h and added SVO_MEMSET... keeping it as macro.
Previous Topic: Please update sources
Next Topic: New GDB frontend for Theide
Goto Forum:
  


Current Time: Sat May 11 07:08:25 CEST 2024

Total time taken to generate the page: 0.03614 seconds