I'm guessing that 0.5 seconds isn't just for one call? Is that total runtime (including everything else), or just the timings for the call on its own?
It's hard to know exactly where the problem lies. You're sure that the agent function is being executed in both cases?
The only thing I could think that could make the first line 30 times slower is if the function (or its prototype) had a huge amount of fields inside it. You could try:
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
I'm guessing that 0.5 seconds isn't just for one call? Is that total runtime (including everything else), or just the timings for the call on its own?
It's hard to know exactly where the problem lies. You're sure that the agent function is being executed in both cases?
The only thing I could think that could make the first line 30 times slower is if the function (or its prototype) had a huge amount of fields inside it. You could try:
And see if that slows it down at all...