Function definition inside let-block impacting performance?

See Please read: make it easier to help you

In particular, put your code into code blocks. That will make it readable and prevent unwanted pings.