<commit_before>#include <stdio.h>
#include <stdint.h>
#include <time.h>

#define WASM_EXPORT __attribute__((used)) __attribute__((visibility ("default")))

struct timespec timespec_diff(struct timespec start, struct timespec end)
{
  struct timespec temp;
  if ((end.tv_nsec-start.tv_nsec)<0) {
    temp.tv_sec = end.tv_sec-start.tv_sec-1;
    temp.tv_nsec = 1000000000+end.tv_nsec-start.tv_nsec;
  } else {
    temp.tv_sec = end.tv_sec-start.tv_sec;
    temp.tv_nsec = end.tv_nsec-start.tv_nsec;
  }
  return temp;
}

WASM_EXPORT
uint32_t fib(uint32_t n)
{
  if(n < 2) {
    return n;
  }
  return fib(n-1) + fib(n-2);
}

int main()
{
  struct timespec start, finish;

  // Chew up some CPU time
  volatile int n=38, result;

  printf("Calculating fib(%d)...\n", n);

  clock_gettime(CLOCK_REALTIME, &start);
  result = fib(n);
  clock_gettime(CLOCK_REALTIME, &finish);

  struct timespec delta = timespec_diff(start, finish);

  printf("Finished in: %lu ms\n", (delta.tv_sec*1000) + (delta.tv_nsec/1000000));
  //printf("ms: %lf\n", delta_s*1000.0 + delta_ns/1000000.0);

  return 0;
}
<commit_msg>Add a TODO<commit_after>#include <stdio.h>
#include <stdint.h>
#include <time.h>

#define WASM_EXPORT __attribute__((used)) __attribute__((visibility ("default")))

struct timespec timespec_diff(struct timespec start, struct timespec end)
{
  struct timespec temp;
  if ((end.tv_nsec-start.tv_nsec)<0) {
    temp.tv_sec = end.tv_sec-start.tv_sec-1;
    temp.tv_nsec = 1000000000+end.tv_nsec-start.tv_nsec;
  } else {
    temp.tv_sec = end.tv_sec-start.tv_sec;
    temp.tv_nsec = end.tv_nsec-start.tv_nsec;
  }
  return temp;
}

WASM_EXPORT
uint32_t fib(uint32_t n)
{
  if(n < 2) {
    return n;
  }
  return fib(n-1) + fib(n-2);
}

int main()
{
  struct timespec start, finish;

  // Chew up some CPU time
  volatile int n=38, result;

  printf("Calculating fib(%d)...\n", n);

  clock_gettime(CLOCK_REALTIME, &start);
  result = fib(n);
  clock_gettime(CLOCK_REALTIME, &finish);

  struct timespec delta = timespec_diff(start, finish);

  printf("Finished in: %lu ms\n", (delta.tv_sec*1000) + (delta.tv_nsec/1000000));

  // TODO: this fails for some reason
  //printf("Finished in: %lf ms\n", delta.tv_sec*1000.0 + delta.tv_nsec/1000000.0);

  return 0;
}

{'fraction_non_alphanumeric': 0.15190434012400356, 'fraction_numerical': 0.04074402125775022, 'mean_word_length': 3.9431072210065645, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5075186', 'n_tokens_mistral': 1008, 'n_tokens_neox': 910, 'n_words': 184}