Procházet zdrojové kódy

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 před 3 dny
rodič
revize
a586f0e80a
3 změnil soubory, kde provedl 1870 přidání a 1823 odebrání
  1. +1
    -1
      CMakeLists.txt
  2. +1835
    -1820
      lib.c
  3. +34
    -2
      main.c

+ 1
- 1
CMakeLists.txt Zobrazit soubor

@ -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
Diff nebyl zobrazen, protože je příliš veliký
Zobrazit soubor


+ 34
- 2
main.c Zobrazit soubor

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

Načítá se…
Zrušit
Uložit