I have a program which is thread 'heavy' and runs much slower in embedded racket (vim) than it does in pure racket.
The program: (note no #lang, as I'm doing this in the repl) (require racket/async-channel) (define (make-passer in) (define chan (make-async-channel)) (thread (lambda () (async-channel-put chan (sync in)))) chan) (define (run-passers num) (define input (make-async-channel)) (define output (for/fold ((chan input)) ((i num)) (make-passer chan))) (define start-time (current-inexact-milliseconds)) (async-channel-put input #f) (sync output) (define end-time (current-inexact-milliseconds)) (- end-time start-time)) (define times '()) (thread (lambda () (collect-garbage) (set! times (cons (run-passers 3) times)) (collect-garbage) (set! times (cons (run-passers 3) times)) (collect-garbage) (set! times (cons (run-passers 3) times)))) If you examine the times variable after sufficient time you get the following: In racket: (0.14501953125 0.134765625 0.619873046875) In vim: (10706.1171875 10999.6611328125 9998.8330078125) If I don't do in in a separate thread, then vim is comparable because it is using the racket scheduler, and not calling scheme_check_threads. Vim calls scheme_check_threads every bit (I think 10 times a second), but it looks like not much progress is made on each of these steps. I can understand if it was slightly slower, but a factor of over 50k is a bit too much. Is it possible for scheme_check_threads to do more work on each invocation in a scenario like this?
_________________________ Racket Developers list: http://lists.racket-lang.org/dev