diff options
author | Martin Reddy <lynx@lindenlab.com> | 2009-09-09 10:21:58 +0000 |
---|---|---|
committer | Martin Reddy <lynx@lindenlab.com> | 2009-09-09 10:21:58 +0000 |
commit | f7231263d47beb4d7eba7eec4231e69967e156cf (patch) | |
tree | aba75d074e9eb091522cf1a9cb402e83caab8a8a /indra/llcommon/lldate.h | |
parent | bc106b1b4b0e8584f76619c002cec4fcbc8eb6fd (diff) |
Fix for DEV-39442: Increased the performance of LLDate::toHTTPDateString
by over 50 times.
Looking at the usage, toHTTPDateStream is not called anywhere (except
internally by toHTTPDateString), and toHTTPDateString is called only
once outside of lldate.cpp, by LLStringUtil::formatDatetime. Also, the
method is most commonly called with a single two-character token, such
as "%Y" or "%A".
I therefore removed toHTTPDateStream and optimized toHTTPDateString.
Setting the locale was the most expensive operation, so I looked into
caching that, both in terms of std::ostream and strftime. The timings
for those implementations (averaged over 10 calls) is:
toHTTPDateString timings:
- with ostream (current) -> 0.314156 ms
- with ostream and std::locale caching -> 0.033999 ms
- with strftime and setlocale() caching -> 0.005985 ms
I therefore went with the standard C library strftime solution.
I also wrote a few unit tests to make sure that I didn't break any
existing functionality, and tested this under Windows and Linux.
Reviewed by steve.
Diffstat (limited to 'indra/llcommon/lldate.h')
-rw-r--r-- | indra/llcommon/lldate.h | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/indra/llcommon/lldate.h b/indra/llcommon/lldate.h index 23d3b900f8..9dcce9117f 100644 --- a/indra/llcommon/lldate.h +++ b/indra/llcommon/lldate.h @@ -86,7 +86,6 @@ public: void toStream(std::ostream&) const; std::string toHTTPDateString (std::string fmt) const; static std::string toHTTPDateString (tm * gmt, std::string fmt); - static void toHTTPDateStream(std::ostream&, tm *, std::string); /** * @brief Set the date from an ISO-8601 string. * |