[cmake-commits] alex committed cmDocumentationFormatterHTML.cxx 1.7
1.8
cmake-commits at cmake.org
cmake-commits at cmake.org
Sun Feb 17 12:31:31 EST 2008
Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv8953
Modified Files:
cmDocumentationFormatterHTML.cxx
Log Message:
PERF: reduce time for full docs as HTML from 1.4 s to 0.2 s, the map is now
created and filled only once instead for every character
I guess a simple case-switch would be still faster.
Alex
Index: cmDocumentationFormatterHTML.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmDocumentationFormatterHTML.cxx,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- cmDocumentationFormatterHTML.cxx 27 Nov 2007 20:59:22 -0000 1.7
+++ cmDocumentationFormatterHTML.cxx 17 Feb 2008 17:31:29 -0000 1.8
@@ -32,11 +32,14 @@
static void cmDocumentationPrintHTMLChar(std::ostream& os, char c)
{
// Use an escape sequence if necessary.
- std::map<char,std::string> escapes;
- escapes['<'] = "<";
- escapes['>'] = ">";
- escapes['&'] = "&";
- escapes['\n'] = "<br>";
+ static std::map<char,std::string> escapes;
+ if (escapes.empty())
+ {
+ escapes['<'] = "<";
+ escapes['>'] = ">";
+ escapes['&'] = "&";
+ escapes['\n'] = "<br>";
+ }
if (escapes.find(c) == escapes.end())
{
More information about the Cmake-commits
mailing list