well, nobody else has efficiency issues with the code you provided.
$ cat forloop.c#include <stdint.h>#include <time.h>#include <stdio.h>void for_loop_time(){ int i, tmp = 0; clock_t t1 = clock(); for (i = 0; i < 1024; i++) { tmp += i; } printf("space %d clock_t value %d \n", (int)(clock() - t1), tmp); //print tmp to prohibit gcc optimize}$ cat testforloop.pasprogram testforloop;{$link ./forloop.o}{$linklib c}uses CTypes, sysutils;procedure for_loop_time; cdecl; external;begin for_loop_time;end.$ cat forlooptest.cvoid for_loop_time();int main() { for_loop_time(); return 0;}$ gcc -o forlooptest forlooptest.c forloop.o$ ./forlooptest space 1 clock_t value 523776$ fpc testforloop.pas Free Pascal Compiler version 3.3.1 [2024/01/01] for x86_64Copyright (c) 1993-2023 by Florian Klaempfl and othersTarget OS: Linux for x86-64Compiling testforloop.pasLinking testforlooptestforloop.pas(13,5) Warning: "crtbegin.o" not found, this will probably cause a linking failuretestforloop.pas(13,5) Warning: "crtend.o" not found, this will probably cause a linking failure13 lines compiled, 0.1 sec, 447056 bytes code, 187008 bytes data2 warning(s) issued$ ./testforloop space 1 clock_t value 523776