Skip to content

Commit

Permalink
Remove debug statements that have affected performance. Refs #4399
Browse files Browse the repository at this point in the history
The GetDetectorOffsets test went from 1->12 seconds with the addition
of the debugging.
  • Loading branch information
martyngigg committed Apr 18, 2012
1 parent 8359c18 commit d4f4b57
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 28 deletions.
1 change: 0 additions & 1 deletion Code/Mantid/Framework/Kernel/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ set ( SRC_FILES
src/ISaveable.cpp
src/InstrumentInfo.cpp
src/Interpolation.cpp
src/IValidator.cpp
src/LibraryManager.cpp
src/LibraryWrapper.cpp
src/ListValidator.cpp
Expand Down
11 changes: 2 additions & 9 deletions Code/Mantid/Framework/Kernel/inc/MantidKernel/IValidator.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
// Includes
//----------------------------------------------------------------------
#include "MantidKernel/DllConfig.h"
#include "MantidKernel/Logger.h"
#include "MantidKernel/DataItem.h"
#include "MantidKernel/Logger.h"
#include <boost/any.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/make_shared.hpp>
Expand Down Expand Up @@ -70,7 +70,7 @@ class DLLExport IValidator
{
public:
/// Constructor
IValidator() : g_log(Logger::get("IValidator"))
IValidator()
{}

///virtual Destructor
Expand All @@ -85,7 +85,6 @@ class DLLExport IValidator
template <typename TYPE>
std::string isValid(const TYPE &value) const
{
g_log.debug() << "IValidator::isValid - Running check for value with typeid " << typeid(value).name() << "\n";
return runCheck(value, IsPtrType<TYPE>());
}

Expand Down Expand Up @@ -124,7 +123,6 @@ class DLLExport IValidator
template<typename T>
std::string runCheck(const T & value, const boost::false_type &) const
{
g_log.debug() << "IValidator::runCheck - Type is not a pointer type.\n";
const T *valuePtr = &value; // Avoid a copy by storing the pointer in the any holder
return check(boost::any(valuePtr));
}
Expand All @@ -135,7 +133,6 @@ class DLLExport IValidator
template<typename T>
std::string runCheck(const T & value, const boost::true_type &) const
{
g_log.debug() << "IValidator::runCheck - Type is a pointer type\n";
return runCheckWithDataItemPtr(value, boost::is_convertible<T, DataItem_sptr>());
}
/** Calls the validator for a pointer type that is NOT convertible to DataItem_sptr
Expand All @@ -145,7 +142,6 @@ class DLLExport IValidator
template<typename T>
std::string runCheckWithDataItemPtr(const T & value, const boost::false_type &) const
{
g_log.debug() << "IValidator::runCheck - Type is not a DataItem_sptr\n";
return check(boost::any(value));
}
/** Calls the validator for a pointer type that IS convertible to DataItem_sptr
Expand All @@ -155,11 +151,8 @@ class DLLExport IValidator
template<typename T>
std::string runCheckWithDataItemPtr(const T & value, const boost::true_type &) const
{
g_log.debug() << "IValidator::runCheck - Type is a DataItem_sptr\n";
return check(boost::any(boost::static_pointer_cast<DataItem>(value)));
}

Logger & g_log;
};

} // namespace Kernel
Expand Down
10 changes: 0 additions & 10 deletions Code/Mantid/Framework/Kernel/inc/MantidKernel/TypedValidator.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
// Includes
//----------------------------------------------------------------------
#include "MantidKernel/IValidator.h"
#include "MantidKernel/Logger.h"
#include <typeinfo>

namespace Mantid
Expand Down Expand Up @@ -113,16 +112,12 @@ namespace Mantid
*/
ElementType_sptr extractValue(const boost::any & value) const
{
g_log.debug() << "TypedValidator<boost::shared_ptr<T>>::extractValue. Value typeid " << value.type().name() << "\n";
g_log.debug() << "typeid(boost::shared_ptr<DataItem>) " << m_dataitemTypeID.name() << "\n";
if( value.type() == m_dataitemTypeID )
{
g_log.debug() << "TypedValidator<boost::shared_ptr<T>>::extractValue. Typeid is DataItem_sptr\n";
return extractFromDataItem(value);
}
else
{
g_log.debug() << "TypedValidator<boost::shared_ptr<T>>::extractValue. Typeid is not a DataItem_sptr\n";
return extractFromSharedPtr(value);
}
}
Expand Down Expand Up @@ -160,16 +155,11 @@ namespace Mantid
}
/// Typeid of DataItem_sptr
static const std::type_info & m_dataitemTypeID;
/// Logger
static Logger & g_log;
};

/// Intialize the DataItem_sptr typeinfo
template<typename T>
const std::type_info & TypedValidator<boost::shared_ptr<T>>::m_dataitemTypeID = typeid(boost::shared_ptr<DataItem>);
/// Initialize logger
template<typename T>
Logger & TypedValidator<boost::shared_ptr<T> >::g_log = Logger::get("TypedValidator");
}
}

Expand Down
8 changes: 0 additions & 8 deletions Code/Mantid/Framework/Kernel/src/IValidator.cpp

This file was deleted.

0 comments on commit d4f4b57

Please sign in to comment.