<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Slow C# query performance vs VBA in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/slow-c-query-performance-vs-vba/m-p/536189#M14511</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Neil,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried your suggestions for speeding up method DetermineOverlapArea and it's just as slow as before. I tried passing in the geometries both as polygons as well as geometries and there is no improvement at all. It takes 10 minutes to get through 5 records.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;A few things to try:&lt;BR /&gt;&lt;BR /&gt;First, a method should only take what it really needs as parameters.&amp;nbsp; In this case, you don't really need 2 features, you need 2 polygons.&amp;nbsp; So I would modify the method signature to this:&lt;BR /&gt;&lt;BR /&gt;public static bool DetermineOverlapArea(IPolygon polygon1, IPolygon polygon2)&lt;BR /&gt;&lt;BR /&gt;When you call the method, pass in the feature geometries cast as polygons.&amp;nbsp; Use ShapeCopy instead of Shape because you don't want your method altering the feature geometries.&lt;BR /&gt;&lt;BR /&gt;Try skipping the geomtry simplification.&amp;nbsp; The general idea here is that an unmodified feature geometry from a feature class will already be simple.&lt;BR /&gt;&lt;BR /&gt;Remove the if/else block at the end and replace it with:&amp;nbsp; return (appOverlap &amp;gt; 5 || ensOverlap &amp;gt; 5);&lt;BR /&gt;Probably not much time savings there but every bit counts.&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 28 Jul 2011 12:56:00 GMT</pubDate>
    <dc:creator>CarlosPiccirillo</dc:creator>
    <dc:date>2011-07-28T12:56:00Z</dc:date>
    <item>
      <title>Slow C# query performance vs VBA</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/slow-c-query-performance-vs-vba/m-p/536181#M14503</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi everyone,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am writing an stand alone C# application and I am having a performance issue. The following code was converted from VBA literally line by line. I am doing a spatial query between two layers. The VBA code runs in between 10 and 15 minutes. The C# code below takes just over 3 hours to do the same query on the same layers as the VBA code. The code below doesn't even start ArcMap, just accesses things directly. I also tried changing the code a bit to start ArcMap in code and then run the code but it still takes the same amount of time.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Obviously, I am missing something/doing something wrong but I can't figure it out. Anyone have any ideas?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Carlos&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;public static void AppsInBoundary()
{ 
&amp;nbsp;&amp;nbsp;&amp;nbsp; try
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
 IFeatureLayer pAppLayer = null;
 IFeatureLayer pEnsLayer = null;
 IFeatureCursor pEvgCursor = null;
 IFeatureCursor pAppCursor = null;
 IFeature pAppFeature = null;
 IFeature pEnsFeature = null;
 IArea pFeatureArea;
 int featureCount = 0;
 int appFieldIndex = 0;
 string geometryFieldName = string.Empty;

 //Get a reference to the two layers involved in the query.
 pAppLayer = GetLayerReference("FILEGDB", "App_Merge", Scratch_Local + "temp.gdb", null) as IFeatureLayer;
 pEnsLayer = GetLayerReference("SDE", "RIM.HYHDB_BSN_EVRGLDS_AREA", null, "gerrpsde") as IFeatureLayer;

 //Make sure layers being queried have the same projection.
 //Otherwise, topological operations later in the code (DetermineOverlapArea) fail.
 SpatialReferenceCheck(pAppLayer, pEnsLayer);

 //Find index of app no field in app_merge layer so query can run faster. 
 appFieldIndex = pAppLayer.FeatureClass.FindField("APP_NO");

 //Select only polygons that have a basin name.
 IQueryFilter pEnsQueryFilter = new QueryFilterClass();
 pEnsQueryFilter.WhereClause = "basin_name &amp;lt;&amp;gt; ' '";

 pEvgCursor = pEnsLayer.Search(pEnsQueryFilter, true);
 pEnsFeature = pEvgCursor.NextFeature();

 ISpatialFilter pAppSpatialFilter = new SpatialFilterClass();

 while (pEnsFeature != null)
 {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; m_Label = pEnsFeature.get_Value(pEnsFeature.Fields.FindField("BASIN_NAME")).ToString();

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pAppSpatialFilter.Geometry = pEnsFeature.Shape;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pAppSpatialFilter.GeometryField = "Shape";
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pAppSpatialFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects;

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pAppCursor = pAppLayer.Search(pAppSpatialFilter, true);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pAppFeature = pAppCursor.NextFeature();

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while (pAppFeature != null)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp; if (pAppFeature.get_Value(appFieldIndex) != DBNull.Value)
&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; m_AppNo = Convert.ToString(pAppFeature.get_Value(appFieldIndex));
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pFeatureArea = pAppFeature.Shape as IArea;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; m_AppArea = pFeatureArea.Area;

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Set relation type, in or adjacent.
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (DetermineOverlapArea(pAppFeature, pEnsFeature) == true)
&amp;nbsp;&amp;nbsp; m_Relation = "AI";&amp;nbsp;&amp;nbsp; //Application In
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else
&amp;nbsp;&amp;nbsp; m_Relation = "AA";&amp;nbsp;&amp;nbsp; //Application Adjacent

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //If app_no is not null, proceed, otherwise skip it.
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (m_AppNo != "")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp; //Check if app status is "no response", if it is not, proceed.
&amp;nbsp;&amp;nbsp; if (AppStatusCheck(m_AppNo) == true)
&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; GetAppInfo(m_AppNo);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PopAppCmgenTables(m_AppNo, m_Relation);
&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pAppFeature = pAppCursor.NextFeature();

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Clear values.
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; m_AppNo = string.Empty;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; m_AppArea = 0;

&amp;nbsp; }&amp;nbsp;&amp;nbsp; //APP_NO != DBNull.Value
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp;&amp;nbsp; //pAppFeature != null

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pEnsFeature = pEvgCursor.NextFeature();

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Clear values.
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; m_AppNo = string.Empty;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; m_Relation = string.Empty;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; m_Label = string.Empty;
 }&amp;nbsp;&amp;nbsp; //pEnsFeature != null
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; catch (Exception ex)
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
 LogError(ex.StackTrace, ex.Message, "AppsInBoundary", null);
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp;&amp;nbsp; 
}

internal static ILayer GetLayerReference(string layerType, string featureClassName, string path, string serverName)
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; try
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
 IWorkspaceFactory pWorkspaceFactory = null;
 IFeatureWorkspace pFeatureWorkspace = null;
 IFeatureClass pFeatureClass = null;

 if (layerType == "SDE")
 {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IPropertySet pPropertySet = new PropertySetClass();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pPropertySet = GetSdePropertySet(serverName, null);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pWorkspaceFactory = new SdeWorkspaceFactoryClass();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pFeatureWorkspace = pWorkspaceFactory.Open(pPropertySet, 0) as IFeatureWorkspace;
 }
 else if (layerType == "FILEGDB")
 {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pWorkspaceFactory = new FileGDBWorkspaceFactoryClass();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pFeatureWorkspace = pWorkspaceFactory.OpenFromFile(path, 0) as IFeatureWorkspace;
 }
 else if (layerType == "PGDB")
 {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pWorkspaceFactory = new AccessWorkspaceFactoryClass();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pFeatureWorkspace = pWorkspaceFactory.OpenFromFile(path, 0) as IFeatureWorkspace;
 }

 pFeatureClass = pFeatureWorkspace.OpenFeatureClass(featureClassName);
 IFeatureLayer pFeatureLayer = new FeatureLayerClass();
 pFeatureLayer.FeatureClass = pFeatureClass;
 return pFeatureLayer;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; catch (Exception ex)
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
 LogError(ex.StackTrace, ex.Message, "GetGroupLayer", null);
 return null;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
}&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Jul 2011 16:08:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/slow-c-query-performance-vs-vba/m-p/536181#M14503</guid>
      <dc:creator>CarlosPiccirillo</dc:creator>
      <dc:date>2011-07-27T16:08:31Z</dc:date>
    </item>
    <item>
      <title>Re: Slow C# query performance vs VBA</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/slow-c-query-performance-vs-vba/m-p/536182#M14504</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;.NET code using ArcObjects will almost always run slower than code written in VBA/VB6.&amp;nbsp; This is because .NET does not directly support COM and VBA/VB6 does.&amp;nbsp; Any call into a COM object in .NET must pass through a runtime callable wrapper (RCW) that acts as a middleman between COM and .NET.&amp;nbsp; Naturally, this slows things down.&amp;nbsp; The more ArcObjects calls you make, the slower it will run.&amp;nbsp; That being said, there are several things you may be able to do to speed things up.&amp;nbsp; The first is to make sure your data is properly indexed.&amp;nbsp; Aside from a spatial index on the feature class, all attribute fields involved in the process should also be indexed.&amp;nbsp; When you execute your queries, setting the Subfields property on the query/spatial filter will help.&amp;nbsp; You should set this property to include only the fields that you need to be populated in the cursor.&amp;nbsp; You should also review your logic to see if there is a way to reduce the number of queries you have to make.&amp;nbsp; I don't know exactly what your code is doing but it looks like you are performing a spatial query on one layer for each feature in the other layer that has a basin name.&amp;nbsp; Could you possibly combine the geometries of all features with the same basin&amp;nbsp; name into a single spatial query?&amp;nbsp; For instance, let's say there are 100 features in the layer with a single basin name.&amp;nbsp; If you add these 100 geometries into a geometry bag and use it to execute a single spatial query then you will eliminate 99 spatial queries from the process.&amp;nbsp; Of course, depending on what it is that you're doing with the query results you may not be able to do this but this is the type of thing you should look for.&amp;nbsp; If all else fails, you may be better off writing this procedure in VB6 or C++ and compiling it into a library that you can then call from your .NET application.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Jul 2011 17:24:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/slow-c-query-performance-vs-vba/m-p/536182#M14504</guid>
      <dc:creator>NeilClemmons</dc:creator>
      <dc:date>2011-07-27T17:24:25Z</dc:date>
    </item>
    <item>
      <title>Re: Slow C# query performance vs VBA</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/slow-c-query-performance-vs-vba/m-p/536183#M14505</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for the reply Neil!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;All the fields I query are indexed as I learned that lesson from you a couple of years ago. I will try your suggestions and see what happens. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In the case of the two layers I am querying, the outter cursor (basin name) layer has only 17 features and there are no duplicate values of basin name. The inner cursor (app_no) has 76,000+ features and they are already merged by app_no to minimize queries so I guess there is no performance improvement there.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have very little VB6 experience, mostly using examples as reference for VBA or C# and no C++ so I will try to convert the code to VB inside of Visual Studio 2008 and see if it runs better there. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you have any other suggestions, I'm all ears. Thanks again for your time!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Carlos&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;.NET code using ArcObjects will almost always run slower than code written in VBA/VB6.&amp;nbsp; This is because .NET does not directly support COM and VBA/VB6 does.&amp;nbsp; Any call into a COM object in .NET must pass through a runtime callable wrapper (RCW) that acts as a middleman between COM and .NET.&amp;nbsp; Naturally, this slows things down.&amp;nbsp; The more ArcObjects calls you make, the slower it will run.&amp;nbsp; That being said, there are several things you may be able to do to speed things up.&amp;nbsp; The first is to make sure your data is properly indexed.&amp;nbsp; Aside from a spatial index on the feature class, all attribute fields involved in the process should also be indexed.&amp;nbsp; When you execute your queries, setting the Subfields property on the query/spatial filter will help.&amp;nbsp; You should set this property to include only the fields that you need to be populated in the cursor.&amp;nbsp; You should also review your logic to see if there is a way to reduce the number of queries you have to make.&amp;nbsp; I don't know exactly what your code is doing but it looks like you are performing a spatial query on one layer for each feature in the other layer that has a basin name.&amp;nbsp; Could you possibly combine the geometries of all features with the same basin&amp;nbsp; name into a single spatial query?&amp;nbsp; For instance, let's say there are 100 features in the layer with a single basin name.&amp;nbsp; If you add these 100 geometries into a geometry bag and use it to execute a single spatial query then you will eliminate 99 spatial queries from the process.&amp;nbsp; Of course, depending on what it is that you're doing with the query results you may not be able to do this but this is the type of thing you should look for.&amp;nbsp; If all else fails, you may be better off writing this procedure in VB6 or C++ and compiling it into a library that you can then call from your .NET application.&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Jul 2011 17:47:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/slow-c-query-performance-vs-vba/m-p/536183#M14505</guid>
      <dc:creator>CarlosPiccirillo</dc:creator>
      <dc:date>2011-07-27T17:47:05Z</dc:date>
    </item>
    <item>
      <title>Re: Slow C# query performance vs VBA</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/slow-c-query-performance-vs-vba/m-p/536184#M14506</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Converting the code to VB.NET will not help as it will still run using COM Interop.&amp;nbsp; It sounds as if the data and the query logic may not the problem.&amp;nbsp; It could be the code inside your GetAppInfo and PopAppCmgenTables methods.&amp;nbsp; That's where I'd start to look for ways to speed things up.&amp;nbsp; How fast do the queries run if you comment out the calls to these two methods.&amp;nbsp; You can put code at various places to calculate how much time it takes to execute blocks of code.&amp;nbsp; I would do this to find where the bottleneck is and then look for ways to overcome it.&amp;nbsp; If you post the code in those bottlenecks I or someone else may be able to offer suggestions.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Jul 2011 17:58:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/slow-c-query-performance-vs-vba/m-p/536184#M14506</guid>
      <dc:creator>NeilClemmons</dc:creator>
      <dc:date>2011-07-27T17:58:29Z</dc:date>
    </item>
    <item>
      <title>Re: Slow C# query performance vs VBA</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/slow-c-query-performance-vs-vba/m-p/536185#M14507</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I commented out both GetAppInfo and PopAppCmgenTables methods and stopped the code after 20 minutes because it took the same amount of time to get through 7 of 17 records as the original code so it looks like the bottle neck is somewhere in there.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am including the code for both GetAppInfo and PopAppCmgenTables methods in case you see ways of improving them. GetAppInfo does a bunch of queries against Access tables and PopAppCmgenTables populates a few tables in another Access database.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have to admit, GetAppInfo is quite large, convoluted and ugly. It's evolved over the years with patches upon patches to deal with quirky data out of my control. When I started converting it to C# from VBA, I thought about trying to redo the method as a clean start but decided against it because I know the original code works well and fast.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I will write out to a text file at the start and end of pieces of code with time stamps and see if I can narrow down the bottleneck.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I had to zip the code up because it was too large to fit in this window and too large to send as a plain text file, sorry.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Jul 2011 18:39:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/slow-c-query-performance-vs-vba/m-p/536185#M14507</guid>
      <dc:creator>CarlosPiccirillo</dc:creator>
      <dc:date>2011-07-27T18:39:25Z</dc:date>
    </item>
    <item>
      <title>Re: Slow C# query performance vs VBA</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/slow-c-query-performance-vs-vba/m-p/536186#M14508</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Use something like this to measure how long a block of code takes to execute.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim startTime As Date = Now
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ' execute a block of code here
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim span As TimeSpan = Now.Subtract(startTime)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Debug.Print("time to execute block:&amp;nbsp; " &amp;amp; span.Seconds &amp;amp; " seconds")
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Just modify the print statement so you can identify what's what in the debug window.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 23:17:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/slow-c-query-performance-vs-vba/m-p/536186#M14508</guid>
      <dc:creator>NeilClemmons</dc:creator>
      <dc:date>2021-12-11T23:17:28Z</dc:date>
    </item>
    <item>
      <title>Re: Slow C# query performance vs VBA</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/slow-c-query-performance-vs-vba/m-p/536187#M14509</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Neil,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;As it turns out, there are two bottlenecks, methods GetAppInfo and DetermineOverlapArea (below). DetermineOverlapArea calculates how much overlap two polygons have. If it's greater than 5%, we record it, otherwise, skip it. No idea why a simple area calculation would slow things down so much.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public static bool DetermineOverlapArea(IFeature pFeature1, IFeature pFeature2)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; { 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IArea pFeature1Area = pFeature1.Shape as IArea;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IArea pFeature2Area = pFeature2.Shape as IArea;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ITopologicalOperator2 pTopologicalOperator = pFeature2.Shape as ITopologicalOperator2;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pTopologicalOperator.IsKnownSimple_2 = false;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pTopologicalOperator.Simplify();

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IArea pIntersectArea = pTopologicalOperator.Intersect(pFeature1.Shape, esriGeometryDimension.esriGeometry2Dimension) as IArea;

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int appOverlap = Convert.ToInt32((pIntersectArea.Area / pFeature1Area.Area) * 100);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int ensOverlap = Convert.ToInt32((pIntersectArea.Area / pFeature2Area.Area) * 100);

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (appOverlap &amp;gt; 5 || ensOverlap &amp;gt; 5)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return true;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return false;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; catch (Exception ex)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LogError(ex.StackTrace, ex.Message, "DetermineOverlapArea", null);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return false;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/PRE&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Use something like this to measure how long a block of code takes to execute.&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim startTime As Date = Now
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ' execute a block of code here
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim span As TimeSpan = Now.Subtract(startTime)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Debug.Print("time to execute block:&amp;nbsp; " &amp;amp; span.Seconds &amp;amp; " seconds")
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;Just modify the print statement so you can identify what's what in the debug window.&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 23:17:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/slow-c-query-performance-vs-vba/m-p/536187#M14509</guid>
      <dc:creator>CarlosPiccirillo</dc:creator>
      <dc:date>2021-12-11T23:17:30Z</dc:date>
    </item>
    <item>
      <title>Re: Slow C# query performance vs VBA</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/slow-c-query-performance-vs-vba/m-p/536188#M14510</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;A few things to try:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;First, a method should only take what it really needs as parameters.&amp;nbsp; In this case, you don't really need 2 features, you need 2 polygons.&amp;nbsp; So I would modify the method signature to this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;public static bool DetermineOverlapArea(IPolygon polygon1, IPolygon polygon2)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When you call the method, pass in the feature geometries cast as polygons.&amp;nbsp; Use ShapeCopy instead of Shape because you don't want your method altering the feature geometries.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Try skipping the geomtry simplification.&amp;nbsp; The general idea here is that an unmodified feature geometry from a feature class will already be simple.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Remove the if/else block at the end and replace it with:&amp;nbsp; return (appOverlap &amp;gt; 5 || ensOverlap &amp;gt; 5);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Probably not much time savings there but every bit counts.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Jul 2011 19:56:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/slow-c-query-performance-vs-vba/m-p/536188#M14510</guid>
      <dc:creator>NeilClemmons</dc:creator>
      <dc:date>2011-07-27T19:56:09Z</dc:date>
    </item>
    <item>
      <title>Re: Slow C# query performance vs VBA</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/slow-c-query-performance-vs-vba/m-p/536189#M14511</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Neil,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried your suggestions for speeding up method DetermineOverlapArea and it's just as slow as before. I tried passing in the geometries both as polygons as well as geometries and there is no improvement at all. It takes 10 minutes to get through 5 records.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;A few things to try:&lt;BR /&gt;&lt;BR /&gt;First, a method should only take what it really needs as parameters.&amp;nbsp; In this case, you don't really need 2 features, you need 2 polygons.&amp;nbsp; So I would modify the method signature to this:&lt;BR /&gt;&lt;BR /&gt;public static bool DetermineOverlapArea(IPolygon polygon1, IPolygon polygon2)&lt;BR /&gt;&lt;BR /&gt;When you call the method, pass in the feature geometries cast as polygons.&amp;nbsp; Use ShapeCopy instead of Shape because you don't want your method altering the feature geometries.&lt;BR /&gt;&lt;BR /&gt;Try skipping the geomtry simplification.&amp;nbsp; The general idea here is that an unmodified feature geometry from a feature class will already be simple.&lt;BR /&gt;&lt;BR /&gt;Remove the if/else block at the end and replace it with:&amp;nbsp; return (appOverlap &amp;gt; 5 || ensOverlap &amp;gt; 5);&lt;BR /&gt;Probably not much time savings there but every bit counts.&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jul 2011 12:56:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/slow-c-query-performance-vs-vba/m-p/536189#M14511</guid>
      <dc:creator>CarlosPiccirillo</dc:creator>
      <dc:date>2011-07-28T12:56:00Z</dc:date>
    </item>
    <item>
      <title>Re: Slow C# query performance vs VBA</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/slow-c-query-performance-vs-vba/m-p/536190#M14512</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I commented out both GetAppInfo and PopAppCmgenTables methods and stopped the code after 20 minutes because it took the same amount of time to get through 7 of 17 records as the original code so it looks like the bottle neck is somewhere in there.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If I am reading this correctly... If you comment out those two methods and the operation is still just as slow, then the bottleneck is &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;not&lt;/SPAN&gt;&lt;SPAN&gt; in those methods.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jul 2011 16:00:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/slow-c-query-performance-vs-vba/m-p/536190#M14512</guid>
      <dc:creator>JeffreyHamblin</dc:creator>
      <dc:date>2011-07-28T16:00:10Z</dc:date>
    </item>
    <item>
      <title>Re: Slow C# query performance vs VBA</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/slow-c-query-performance-vs-vba/m-p/536191#M14513</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Aparently, I messed up doing the first test because when I repeated them later trying some of Neil's suggestion, the code took less than a minute. The bottleneck is definitely between GetAppInfo and DetermineOverlapArea. The biggest bottleneck seems to be DetermineOverlapArea. I've been trying alternative code all day and get the same slow results.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jul 2011 16:05:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/slow-c-query-performance-vs-vba/m-p/536191#M14513</guid>
      <dc:creator>CarlosPiccirillo</dc:creator>
      <dc:date>2011-07-28T16:05:02Z</dc:date>
    </item>
    <item>
      <title>Re: Slow C# query performance vs VBA</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/slow-c-query-performance-vs-vba/m-p/536192#M14514</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The most expensive thing the method does is call the Intersect method.&amp;nbsp; How long does it take for that one line of code to execute?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jul 2011 19:07:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/slow-c-query-performance-vs-vba/m-p/536192#M14514</guid>
      <dc:creator>NeilClemmons</dc:creator>
      <dc:date>2011-07-28T19:07:07Z</dc:date>
    </item>
    <item>
      <title>Re: Slow C# query performance vs VBA</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/slow-c-query-performance-vs-vba/m-p/536193#M14515</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;How long do the convert.toint32 functions taking? If they are significant (type conversions are one thing slower because of the .Net interop) you can probably do without it and compare the doubles.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jul 2011 20:45:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/slow-c-query-performance-vs-vba/m-p/536193#M14515</guid>
      <dc:creator>AlexanderGray</dc:creator>
      <dc:date>2011-07-28T20:45:48Z</dc:date>
    </item>
    <item>
      <title>Re: Slow C# query performance vs VBA</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/slow-c-query-performance-vs-vba/m-p/536194#M14516</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Neil, Alexander,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Sorry for the late reply. I was out Thursday afternoon and all day Friday. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Neil, you are correct, the bottleneck is the Intersect command in the DeterimeOverlapArea method. I'm trying to figure out what I can use in it's place that might be faster.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Alexander, the Convert.ToInt32 is very fast so that part of the code is okay although I will try your suggestion. Every little bit of speed increase helps.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Carlos&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Aug 2011 10:11:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/slow-c-query-performance-vs-vba/m-p/536194#M14516</guid>
      <dc:creator>CarlosPiccirillo</dc:creator>
      <dc:date>2011-08-01T10:11:50Z</dc:date>
    </item>
    <item>
      <title>Re: Slow C# query performance vs VBA</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/slow-c-query-performance-vs-vba/m-p/536195#M14517</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Carlos,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;From my experience arcobjects should never be instantiated&amp;nbsp; in every iteration of while loop if possible. In your case IArea pFeature1Area,IArea pFeature2Area,ITopologicalOperator2 pTopologicalOperator can be declared once globally and can be reused. You can use pTopologicalOperator.Boundary.SetEmpty(); to release memory&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Oct 2011 20:03:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/slow-c-query-performance-vs-vba/m-p/536195#M14517</guid>
      <dc:creator>NehaS1</dc:creator>
      <dc:date>2011-10-26T20:03:54Z</dc:date>
    </item>
    <item>
      <title>Re: Slow C# query performance vs VBA</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/slow-c-query-performance-vs-vba/m-p/536196#M14518</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;How many records are stored in&amp;nbsp; pAppLayerand pEnsLayer? Is it sde?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Oct 2011 20:19:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/slow-c-query-performance-vs-vba/m-p/536196#M14518</guid>
      <dc:creator>NehaS1</dc:creator>
      <dc:date>2011-10-26T20:19:28Z</dc:date>
    </item>
    <item>
      <title>Re: Slow C# query performance vs VBA</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/slow-c-query-performance-vs-vba/m-p/536197#M14519</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Samham,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for the reply! pAppLayer is in a file geodatabase and pEnsLayer is in SDE.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; Not sure I follow you when you say, "From my experience arcobjects should never be instantiated in every iteration of while loop if possible."&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Do you have an example of what you mean? &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I will be out until Monday so my appologies ahead of time if I am late replying to any replies you post. Thanks again!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Carlos&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;How many records are stored in&amp;nbsp; pAppLayerand pEnsLayer? Is it sde?&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Oct 2011 20:37:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/slow-c-query-performance-vs-vba/m-p/536197#M14519</guid>
      <dc:creator>CarlosPiccirillo</dc:creator>
      <dc:date>2011-10-26T20:37:35Z</dc:date>
    </item>
    <item>
      <title>Re: Slow C# query performance vs VBA</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/slow-c-query-performance-vs-vba/m-p/536198#M14520</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;For example if pAppLayer&amp;nbsp; has 100,000 records then you are iterating 100,000 times and creating 100,000&amp;nbsp; ITopologicalOperator2 pTopologicalOperator. Why not create one ITopologicalOperator2 pTopologicalOperator and reuse it?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Oct 2011 20:58:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/slow-c-query-performance-vs-vba/m-p/536198#M14520</guid>
      <dc:creator>NehaS1</dc:creator>
      <dc:date>2011-10-26T20:58:30Z</dc:date>
    </item>
    <item>
      <title>Re: Slow C# query performance vs VBA</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/slow-c-query-performance-vs-vba/m-p/536199#M14521</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;When you comment the method how much time does it take to iterate through all the records?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Oct 2011 21:00:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/slow-c-query-performance-vs-vba/m-p/536199#M14521</guid>
      <dc:creator>NehaS1</dc:creator>
      <dc:date>2011-10-26T21:00:07Z</dc:date>
    </item>
    <item>
      <title>Re: Slow C# query performance vs VBA</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/slow-c-query-performance-vs-vba/m-p/536200#M14522</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If you consider your app's performance is more valuable then time you spend for optimizing then this effort is valid one, in other cases let the user wait.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;There are two way approach.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ne is to use VB code create COM object that you will refer from you project and use it when needed and you'll be very close to ArcMap speed.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Second:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;There try to use IRelationalOperator instead of ITopologicalOperator sinc you are using just a part of ITopologicalOperator functions. Please try to measure how much you will be faster. Neil is again totally right, this time about Simplify,&amp;nbsp; people use this very often. Since you are not modifying geometry the is no need for this operation.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If you are satisfied with the speed, then you can consider using managed C++. There you'll save interop operation time.&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/0001/0001000000wm000000.htm"&gt;http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/0001/0001000000wm000000.htm&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Oct 2011 08:02:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/slow-c-query-performance-vs-vba/m-p/536200#M14522</guid>
      <dc:creator>DubravkoAntonic</dc:creator>
      <dc:date>2011-10-28T08:02:39Z</dc:date>
    </item>
  </channel>
</rss>

