Succumbing to the speed bug, I made my Scheme code mzscheme-compliant,
and put 3 files into modules and compiled native code with mzc. I had
trouble reading help-desk, and might be doing various things wrong.
Mainly I'm having trouble running background jobs (on a Linux box).
I have a 1-line file `run-mzc-script' whose 1 line is:
(require "create-mzc-wfile.scm")
create-mzc-wfile.scm, compiled to native code, writes output to a file
`wfile-tslex-out' by (fprintf port ...). I ran it successfully as a
foreground job; here's the xterm window output:
(kepler)cur> mzscheme -r run-mzc-script
"wfile-tslex-out existed, now removing"
[1]+ Terminated mzscheme -r run-mzc-script
(kepler)cur> more wfile-tslex-out
time = 1050542622
(s = 16)time = 1050543548
(s = 17)time = 1050543719
(s = 18)time = 1050543719
I'm using current-seconds to time the job, which took
(- 1050543719 1050542622) => 1097 seconds = 18 minutes
But I just ran it as a background job, and only got the 1st 2 lines of
output when the job exited:
(kepler)cur> more wfile-tslex-out
time = 1050543986
(s = 16)time = 1050544911
(s = 17)
So 18 minutes for 3 calculations, s = 16, 17, 18, but 15.4 minutes for
the 1st calculation s = 16.
By background job, I mean the following. In the xterm window I type
mzscheme -r run-mzc-script &
and then I kill the xterm window by C-d and even by clicking on the
"x" box to destroy the window. Clearly the job continued to run after
I killed the window. But I only got the first (s = 16) calculation.
My theory is that my background job gets messed up by writing to a
file by (fprintf port ...). Instead of boring you with my whole
code, let's just look at the output:
time = 1050543986
(s = 16)time = 1050544911
(s = 17)
The program performs almost no calculation before writing
time = 1050543986
(s = 16)
but then it has to do a lot of calculating to print the 2nd time. But
once that happens, the line (s = 17) requires little calculation. But
then my program has to do the calculation for (s = 17), and that's
where the hasty exit happened.
There's a lot I don't understand yet. I'm assuming that `require'
using the compiled version of the files, but I don't actually know
that. I found various hints in the direction.