1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +02:00

VCAI performance improvements

* Node graph initialization optimized.
* Fixed "Unathorized obstacle access".
* Pathfinding tracing disabled with ifdef.
* Misc bonus calculation optimizations.
* Removed timestamp from log lines. Date formatting eats too much CPU.
* Paths for all heroes in Client are now cached
This commit is contained in:
AlexVinS
2019-01-15 06:00:00 +03:00
parent 8fee46de7c
commit 4b5910c2f4
25 changed files with 472 additions and 347 deletions

View File

@@ -231,12 +231,14 @@ std::vector<std::string> CLogManager::getRegisteredDomains() const
return std::move(domains);
}
CLogFormatter::CLogFormatter() : CLogFormatter("%m") { }
CLogFormatter::CLogFormatter(const std::string & pattern) : pattern(pattern)
CLogFormatter::CLogFormatter()
: CLogFormatter("%m")
{
}
CLogFormatter::CLogFormatter(const std::string & pattern)
: pattern(pattern)
{
boost::posix_time::time_facet * facet = new boost::posix_time::time_facet("%H:%M:%S.%f");
dateStream.imbue(std::locale(dateStream.getloc(), facet));
}
CLogFormatter::CLogFormatter(const CLogFormatter & c) : pattern(c.pattern) { }
@@ -258,7 +260,7 @@ std::string CLogFormatter::format(const LogRecord & record) const
std::string message = pattern;
//Format date
boost::algorithm::replace_first(message, "%d", boost::posix_time::to_simple_string (record.timeStamp));
// boost::algorithm::replace_first(message, "%d", boost::posix_time::to_simple_string (record.timeStamp));
//Format log level
std::string level;
@@ -387,7 +389,8 @@ void CLogConsoleTarget::setColorMapping(const CColorMapping & colorMapping) { th
CLogFileTarget::CLogFileTarget(boost::filesystem::path filePath, bool append)
: file(std::move(filePath), append ? std::ios_base::app : std::ios_base::out)
{
formatter.setPattern("%d %l %n [%t] - %m");
// formatter.setPattern("%d %l %n [%t] - %m");
formatter.setPattern("%l %n [%t] - %m");
}
void CLogFileTarget::write(const LogRecord & record)