I have written a script which snaps points to lines, it is a more complex version of the Snapper tool, except it snaps points to a specific end of a line depending on its orientation and connections to other lines.
The script works fine as is. I use a With statement to open the update cursor and then a for loop, to loop through the points, each point then searches for lines within a given distance to find an appropriate line to snap said point to. I am not using edit.start/edit.stop as I believe that the With opening the updateCursor is handing this.
Now, I am running the script while I have the data open and visible on ArcPro. When I run the script normally I do not have any unsaved edits from manual editing (so the save button under the edit ribbon is greyed out). When I run the script it takes about 10 seconds per point to process and snap a point to a nearby line (if there is one). Once this is finished the edits are saved automatically (the save button under the edit ribbon is still greyed out)
But. If I edit a point manually, and I have unsaved edits open (the save button in edit ribbon is coloured) and run the script, it processes at about 10 times faster than before, taking only one second per point to process. I have not noticed any issues with the data which has been processed this way. I can hit save after this processing and all changes are saved.
This has lead me to believe that somehow my script is committing saves for each point it processes (when I have no unsaved edits) and making my script run much slower than it could.
My question is: How can I impliment what is happening here in my script so I do not need to do this weird trick to get faster processing,
EDIT: attached script