<?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 Would Like to Improve Performance in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/would-like-to-improve-performance/m-p/18153#M1435</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm working on a script in which I need to compare&amp;nbsp;historical parcel ids in one table to a set of current parcel ids.&amp;nbsp; I'm using a couple of dictionaries and lists to do so, but the final dictionary I create seems to take forever. I'd like to speed that process up.&amp;nbsp;&amp;nbsp;&amp;nbsp;Here is the code:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;import arcpy

bucket = r'J:\PythonDevelopment\ParcelsXY_Mojo\ParcelsMojo.gdb\LocalSlcoDept_ParcelsXY'
current = r'J:\PythonDevelopment\ParcelsXY_Mojo\ParcelsMojo.gdb\ParcelsLite_Points'

currentFields = ['PIN','XCOORD','YCOORD']
bucketFields = ['parcel_id','XCOORD','YCOORD']

currentDict = {r[0]:(r[1:]) for r in arcpy.da.SearchCursor(current,currentFields)}

selectField = ['parcel_id']
selectList = [r[0] for r in arcpy.da.SearchCursor(bucket,selectField)]

addThese = {key:value for key,value in currentDict.items() if key not in selectList}‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;bucket is the historical parcels, and current is what is current as of today. in bucket, the parcel id is in the field called parcel_id while in current it's called PIN.&amp;nbsp; The premise is if the PIN is already in parcel_id, skip it; if it's not there, append to addThese{} which an InsertCursor will eventually use to add into bucket.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Bucket has 431,000 records while current has 375,00 records.&amp;nbsp; Everything goes along nicely until line 14. Maybe I'm just being impatient, and 17&amp;nbsp;minutes is what it takes to plow through the list and dictionary....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 10 Dec 2021 20:44:05 GMT</pubDate>
    <dc:creator>JoeBorgione</dc:creator>
    <dc:date>2021-12-10T20:44:05Z</dc:date>
    <item>
      <title>Would Like to Improve Performance</title>
      <link>https://community.esri.com/t5/python-questions/would-like-to-improve-performance/m-p/18153#M1435</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm working on a script in which I need to compare&amp;nbsp;historical parcel ids in one table to a set of current parcel ids.&amp;nbsp; I'm using a couple of dictionaries and lists to do so, but the final dictionary I create seems to take forever. I'd like to speed that process up.&amp;nbsp;&amp;nbsp;&amp;nbsp;Here is the code:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;import arcpy

bucket = r'J:\PythonDevelopment\ParcelsXY_Mojo\ParcelsMojo.gdb\LocalSlcoDept_ParcelsXY'
current = r'J:\PythonDevelopment\ParcelsXY_Mojo\ParcelsMojo.gdb\ParcelsLite_Points'

currentFields = ['PIN','XCOORD','YCOORD']
bucketFields = ['parcel_id','XCOORD','YCOORD']

currentDict = {r[0]:(r[1:]) for r in arcpy.da.SearchCursor(current,currentFields)}

selectField = ['parcel_id']
selectList = [r[0] for r in arcpy.da.SearchCursor(bucket,selectField)]

addThese = {key:value for key,value in currentDict.items() if key not in selectList}‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;bucket is the historical parcels, and current is what is current as of today. in bucket, the parcel id is in the field called parcel_id while in current it's called PIN.&amp;nbsp; The premise is if the PIN is already in parcel_id, skip it; if it's not there, append to addThese{} which an InsertCursor will eventually use to add into bucket.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Bucket has 431,000 records while current has 375,00 records.&amp;nbsp; Everything goes along nicely until line 14. Maybe I'm just being impatient, and 17&amp;nbsp;minutes is what it takes to plow through the list and dictionary....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 20:44:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/would-like-to-improve-performance/m-p/18153#M1435</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2021-12-10T20:44:05Z</dc:date>
    </item>
  </channel>
</rss>

