Pārlūkot izejas kodu

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 pirms 3 dienas
vecāks
revīzija
a586f0e80a
3 mainītis faili ar 1870 papildinājumiem un 1823 dzēšanām
  1. +1
    -1
      CMakeLists.txt
  2. +1835
    -1820
      lib.c
  3. +34
    -2
      main.c

+ 1
- 1
CMakeLists.txt Parādīt failu

@ -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
Failā izmaiņas netiks attēlotas, jo tās ir par lielu
Parādīt failu


+ 34
- 2
main.c Parādīt failu

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

Notiek ielāde…
Atcelt
Saglabāt