Ver a proveniência

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 há 3 dias
ascendente
cometimento
a586f0e80a
3 ficheiros alterados com 1870 adições e 1823 eliminações
  1. +1
    -1
      CMakeLists.txt
  2. +1835
    -1820
      lib.c
  3. +34
    -2
      main.c

+ 1
- 1
CMakeLists.txt Ver ficheiro

@ -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
A apresentação das diferenças no ficheiro foi suprimida por ser demasiado grande
Ver ficheiro


+ 34
- 2
main.c Ver ficheiro

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

Carregando…
Cancelar
Guardar