Welcome to the CHICKEN Scheme pasting service
CHICKEN is faster than C++ ! pasted by Bunny351 on Wed Apr 24 13:24:41 2024
; cat x.cpp #include <stdio.h> void foo() { throw 1; } int main() { for(int i = 0; i < 1000000; ++i) { try { foo(); } catch(...) {} } } ; c++ x.cpp -o a.out ; time ./a.out 8.230u 0.010s 8.204r ./a.out ; cat x.scm (define (foo k) (k 123)) (let loop ((i 0)) (if (>= i 1000000) (begin (call-with-current-continuation (lambda (k) (foo k))) (loop (+ i 1))))) ; csc x.scm -o a.out ; time ./a.out 0.010u 0.000s 0.010r ./a.out
And now the correct version! added by Bunny351 on Wed Apr 24 13:27:00 2024
; cat x.scm (define (foo k) (k 123)) (let loop ((i 0)) (if (< i 1000000) (begin (call-with-current-continuation (lambda (k) (foo k))) (loop (+ i 1))))) ; csc x.scm -o a.out ; time ./a.out 0.330u 0.000s 0.321r ./a.out