[cups.development] [RFE] STR #2362: use strcmp() instead of strcasecmp() for better performance

katsura katsura at mac.com
Thu Apr 26 15:12:48 PDT 2007


DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

i just measured the speed of strcmp() vs strcasecmp(), and the difference
is significant (26x! well, depends on the input strings, of course).

strcmp(): 0.003862 second
strcasecmp(): 0.101159 second

we probably don't want to break the exisitng PPD files with mixed cases
that are working fine with the current code, so i suggest that you change
the code to use strcmp() and store all strings in lowercase, and use a
constant keyword like kCUPSChoiceNone for example because
kCUPSOpenSubGroup is probably eaiser to read than "opensubgroup" (all
lowercase).

old:
  strcasecmp(c2->choice, "None")

new:
  #define kCUPSChoiceNone "none"

  strcmp(c2->choice, kCUPSChoiceNone)

regards,
katsura

Link: http://www.cups.org/str.php?L2362
Version:  -feature





More information about the cups mailing list