You're right. The difference is slight on debug builds, but it doubles the execution time on release builds.
Looking at the .s code generated, you can see that when locals are used all the variables are kept in the processor registers. When globals are used, the variables have to be pulled in and pushed out of main memory each time.
Chances are that an intelligent C compiler would realise that you can fit all of the variables in processor registers and optimise accordingly. If you create a few more local and global variables in the C test, it might have to start storing them in RAM too.
Looking at the .s code generated, you can see that when locals are used all the variables are kept in the processor registers. When globals are used, the variables have to be pulled in and pushed out of main memory each time.
Chances are that an intelligent C compiler would realise that you can fit all of the variables in processor registers and optimise accordingly. If you create a few more local and global variables in the C test, it might have to start storing them in RAM too.