Parcourir la source

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 il y a 3 jours
Parent
révision
a586f0e80a
3 fichiers modifiés avec 1870 ajouts et 1823 suppressions
  1. +1
    -1
      CMakeLists.txt
  2. +1835
    -1820
      lib.c
  3. +34
    -2
      main.c

+ 1
- 1
CMakeLists.txt Voir le fichier

@ -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
Fichier diff supprimé car celui-ci est trop grand
Voir le fichier


+ 34
- 2
main.c Voir le fichier

@ -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;

Chargement…
Annuler
Enregistrer