Horde3D

Next-Generation Graphics Engine
It is currently 20.04.2024, 02:56

All times are UTC + 1 hour




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: 18.11.2008, 21:18 
Offline

Joined: 26.03.2008, 02:58
Posts: 160
Hi,

I was looking at the Converter code recently , doing a debug session, and i noticed that the XMLParser does a char compare on the tags to find the proper elements to copy. I noticed on a few occasions it compared two or more chars until it reached a diff char. Does anyone know if doing a len compare first is more expensive, than a char compare, because most of the tags don't have the same amount of chars, it would probably save a couple of compares, not exactly a huge issue, just wondering while i was debugging and decided to post about it.


Top
 Profile  
Reply with quote  
PostPosted: 18.11.2008, 21:37 
Offline

Joined: 22.11.2007, 17:05
Posts: 707
Location: Boston, MA
It looks like those are C-strings (char *), which means NULL terminated, in which case a length comparison is O(n), because you have to iterate over the strings to find the NULL characters.

_________________
Tristam MacDonald - [swiftcoding]


Top
 Profile  
Reply with quote  
PostPosted: 18.11.2008, 21:40 
Offline

Joined: 26.03.2008, 02:58
Posts: 160
ok, thanks for the info, there is no point in doing a len compare then ;)


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 14 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group