You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-dev@logging.apache.org by ni...@apache.org on 2005/01/28 21:50:29 UTC
cvs commit: logging-log4net/src/Repository/Hierarchy Hierarchy.cs Logger.cs
nicko 2005/01/28 12:50:29
Modified: src/Repository/Hierarchy Hierarchy.cs Logger.cs
Log:
Added casting to improve performace when comparing Level object against null. Only reference equals is required
Revision Changes Path
1.15 +2 -1 logging-log4net/src/Repository/Hierarchy/Hierarchy.cs
Index: Hierarchy.cs
===================================================================
RCS file: /home/cvs/logging-log4net/src/Repository/Hierarchy/Hierarchy.cs,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- Hierarchy.cs 17 Jan 2005 20:18:47 -0000 1.14
+++ Hierarchy.cs 28 Jan 2005 20:50:28 -0000 1.15
@@ -629,7 +629,8 @@
/// </remarks>
public bool IsDisabled(Level level)
{
- if (level == null)
+ // Cast level to object for performance
+ if ((object)level == null)
{
throw new ArgumentNullException("level");
}
1.11 +5 -2 logging-log4net/src/Repository/Hierarchy/Logger.cs
Index: Logger.cs
===================================================================
RCS file: /home/cvs/logging-log4net/src/Repository/Hierarchy/Logger.cs,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- Logger.cs 17 Jan 2005 20:18:47 -0000 1.10
+++ Logger.cs 28 Jan 2005 20:50:28 -0000 1.11
@@ -144,9 +144,12 @@
{
for(Logger c = this; c != null; c = c.m_parent)
{
- if (c.m_level != null)
+ Level level = c.m_level;
+
+ // Casting level to Object for performance, otherwise the overloaded operator is called
+ if ((object)level != null)
{
- return c.m_level;
+ return level;
}
}
return null; // If reached will cause an NullPointerException.