lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject [Lucene.Net] svn commit: r1170331 - /incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/contrib/Snowball/Lucene.Net/Analysis/Snowball/SnowballFilter.cs
Date Tue, 13 Sep 2011 20:22:54 GMT
Author: digy
Date: Tue Sep 13 20:22:54 2011
New Revision: 1170331

URL: http://svn.apache.org/viewvc?rev=1170331&view=rev
Log:
[LUCENENET-412] Slight performance improvement for SnowballFilter

Modified:
    incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/contrib/Snowball/Lucene.Net/Analysis/Snowball/SnowballFilter.cs

Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/contrib/Snowball/Lucene.Net/Analysis/Snowball/SnowballFilter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/contrib/Snowball/Lucene.Net/Analysis/Snowball/SnowballFilter.cs?rev=1170331&r1=1170330&r2=1170331&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/contrib/Snowball/Lucene.Net/Analysis/Snowball/SnowballFilter.cs
(original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/contrib/Snowball/Lucene.Net/Analysis/Snowball/SnowballFilter.cs
Tue Sep 13 20:22:54 2011
@@ -37,7 +37,8 @@ namespace Lucene.Net.Analysis.Snowball
 		private static readonly System.Object[] EMPTY_ARGS = new System.Object[0];
 		
 		private SnowballProgram stemmer;
-		private System.Reflection.MethodInfo stemMethod;
+		private delegate bool StemMethodDelegate();
+        private StemMethodDelegate stemMethod;
 		
 		/// <summary>Construct the named stemming filter.
 		/// 
@@ -53,7 +54,7 @@ namespace Lucene.Net.Analysis.Snowball
 				System.Type stemClass = System.Type.GetType("SF.Snowball.Ext." + name + "Stemmer");
 				stemmer = (SnowballProgram) System.Activator.CreateInstance(stemClass);
 				// why doesn't the SnowballProgram class have an (abstract?) stem method?
-				stemMethod = stemClass.GetMethod("Stem", (new System.Type[0] == null) ? new System.Type[0]
: (System.Type[]) new System.Type[0]);
+				stemMethod = (StemMethodDelegate)Delegate.CreateDelegate(typeof(StemMethodDelegate),stemmer,stemClass.GetMethod("Stem",
new Type[0])); 
 			}
 			catch (System.Exception e)
 			{
@@ -70,7 +71,7 @@ namespace Lucene.Net.Analysis.Snowball
 			stemmer.SetCurrent(token.TermText());
 			try
 			{
-				stemMethod.Invoke(stemmer, (System.Object[]) EMPTY_ARGS);
+                stemMethod(); 
 			}
 			catch (System.Exception e)
 			{



Mime
View raw message