@DTS Engineer
Thanks for the information. I believe I will use them later.
Now, back to the problem.
In Xcode, I use "Clean build folder", enable "Allow Unsigned executable memory" in Signing & Capabilities, and let Xcode automatically manage signing with my personal developer team and my Developer certificate/ID.
I use Product -> Build followed by Product -> Run, and I am happy. I click on the "Do Lua script" button and it takes 0.1 seconds to finish the script.
I use Product -> Run again (no rebuild, resigning), and I am surprised, I click on the "Do Lua script" button, select the same script and it takes 18 seconds to finish it.
Sometimes 2nd, 3rd runs still work well.
So, it looks like entitlements "Allow Unsigned executable memory" work as expected but unfortunately only some short time after the app signs. If it is a problem in the application I expect a deterministic entitlement behavior if I use the same inputs. I see also the same call sequences in the debugger.
This does not look like an application problem to me but like some crazy signing issue. I did not find anything successful to fix it, so I am here.
What should I do to determine what is going on and how to fix it?