Quellcode durchsuchen

Added more conditional removal of code, removed some extra work and pushed clearing of routines out of the normal path to avoid clearing memory we may want to reuse very soon

main
Ludovic 'Archivist' Lagouardette vor 3 Tagen
Ursprung
Commit
a586f0e80a
3 geänderte Dateien mit 1870 neuen und 1823 gelöschten Zeilen
  1. +1
    -1
      CMakeLists.txt
  2. +1835
    -1820
      lib.c
  3. +34
    -2
      main.c

+ 1
- 1
CMakeLists.txt Datei anzeigen

@ -20,7 +20,7 @@ add_library(ink lib.c include/ink.h)
# Removes several checks to improve performance in cases where ink is used as a bytecode
# add_definitions(-DNOEXTRACHECKS)
add_definitions(-DINK_STEP_BATCH_COUNT=5)
add_definitions(-DINK_STEP_BATCH_COUNT=20)
add_executable(ink_exe main.c)
target_link_libraries(ink_exe PUBLIC ink)

+ 1835
- 1820
lib.c
Datei-Diff unterdrückt, da er zu groß ist
Datei anzeigen


+ 34
- 2
main.c Datei anzeigen

@ -29,14 +29,46 @@ int main(int argc, char** argv) {
fclose(file);
}
ink_compile(ctx, read_buffer);
ink_compile(ctx, read_buffer);
ink_compile(ctx, read_buffer);
ink_compile(ctx, read_buffer);
ink_compile(ctx, read_buffer);
ink_compile(ctx, read_buffer);
ink_compile(ctx, read_buffer);
ink_compile(ctx, read_buffer);
ink_compile(ctx, read_buffer);
ink_compile(ctx, read_buffer);
ink_compile(ctx, read_buffer);
ink_compile(ctx, read_buffer);
ink_compile(ctx, read_buffer);
ink_compile(ctx, read_buffer);
ink_compile(ctx, read_buffer);
ink_compile(ctx, read_buffer);
ink_compile(ctx, read_buffer);
ink_compile(ctx, read_buffer);
ink_compile(ctx, read_buffer);
int increment = 1 << 16;
int counter = increment;
int c;
begin = clock();
clock_gettime(CLOCK_MONOTONIC, &start_time);
while(ink_can_run(ctx)) {
ink_step_everyone(ctx);
for(c = 0; c < 64; ++c)
ink_step_everyone(ctx);
if(ctx->steps < counter) {
ink_gc(ctx);
counter += increment;
}
}
clock_gettime(CLOCK_MONOTONIC, &end_time);
ink_gc(ctx);
end = clock();
time_spent = ctx->steps/(double)((end - begin) / CLOCKS_PER_SEC);
s_total += (end_time.tv_sec - start_time.tv_sec) + (end_time.tv_nsec - start_time.tv_nsec) / 1.0e9;

Laden…
Abbrechen
Speichern