Script takes very long time

Hi,
I’ve made this script to add the crosses to my railway. it works good but take more than 7 hours to run.
Any idea where is the problem or how can I make my script more effective.
the length of my alignment is 103330 m and I’m adding the cross every 0.6 m
Thanks.

you can use this tool to evaluate where it is bottling up : TuneUp Extension: Explore your Node and Graph execution times - Dynamo BIM

Is there a reason to have such a long alignment? I mean its 100km… that’s huge to have in a single model where you also have a sufficient LOD to include the sleepers (traverses)

Thank you that was really helpful. I’m doing an internship, the company asked my to do that and this is my first script in Dynamo so I wasn’t sure if the problem is in my code or caused by the length of the Alignment.