Faster analogread and floating point calculations on STM32?

Maybe Online compiler uses the release profile and Studio uses the debug profile or something. I am pretty sure you can change the compiler optimization settings with Studio. You just modify json files and specify which one to use.

https://os.mbed.com/docs/mbed-os/v6.0/program-setup/build-profiles-and-rules.html

Here is an example of how optimization can make a difference.