Subject: Re: bug#18522: 24.4.50; mapcar is very slow

From: Eli Zaretskii <[email-masked]>
Date: Fri, 26 Feb 2016 10:48:16 +0200

> From: Lars Ingebrigtsen <[email-masked]>
> Cc: Peter Münster <[email-masked]>,
>   [email-masked]
> Date: Fri, 26 Feb 2016 13:43:44 +1030
> 
> >  . parse-time-string should try to avoid binding case-fold-search
> >    globally, or at all
> 
> It's kinda weird.  This starts with:
> 
> (defun parse-time-string (string)
> 
> [...]
> 
> 	(temp (parse-time-tokenize (downcase string))))
> 
> which calls
> 
> (defsubst parse-time-string-chars (char)
>   (save-match-data
>     (let (case-fold-search str)
>       (cond ((eq char ?+) 1)
> 	    ((eq char ?-) -1)
> 	    ((eq char ?:) ?d)
> 	    ((string-match "[[:upper:]]" (setq str (string char))) ?A)
> 	    ((string-match "[[:lower:]]" str) ?a)
> 	    ((string-match "[[:digit:]]" str) ?0)))))
> 
> !?
> 
> Since we've already downcased the entire string, both the
> `case-fold-search' and the match to [[:upper:]] seem rather
> nonsensical?

Yes, weird.  And even if someone thought of using
parse-time-string-chars in other places that don't necessarily
downcase the string, I don't understand why we should test a character
by making it a string, then matching against [:upper:].  Maybe I'm
missing something.