This is lighter-weight than building a full index->cursor table for
the string, adding a constant two words to the memory required to
store a string, as opposed to one word for every n characters. The
cached cursor is used for any string-ref operation requesting an index
after the most-recently-requested index, making potentially quadratic
repeated string-ref procedures run in linear time. In theory, it could
also use a heuristic to speed up moving backwards through the string
when it thinks that moving the old cursor backwards would be faster
than starting again at the start of the string. In practice, my
logging of when the cached cursor is actually reused during the Chibi
compilation and startup process shows that the most common case of
moving backwards is going back to the start of the string anyway.
Benchmarks to follow.
In `servlet-respond', the server defaults to Content-Type "text/html;
charset=UTF-8" for extensions that don't appear in
`mime-type-from-extension'. This meant that CSS files, JavaScript
files, and various types of image files were getting the wrong
Content-Type, which was fine when they were served directly, but
caused clients to close the connection when they were loaded over
HTTP/1.1, which can deliver back-to-back resources on the same
connection.
Sort the types in the `mime-type-from-extension' list now that it is
longer. It's still not long enough for the order to be material for
performance.
This restores third-party (ab)users of the Chibi macro system such
as in https://gist.github.com/baguette/2632464, while allowing us
to break those uses in more interesting ways.
It also keeps the core slightly smaller (both in C and Scheme)
and speeds up the macro expansion process.
Add some newlines and a comment to improve readability.
Use local string port instead of parameterizing current-output-port.
Pass symbol 'BEGIN to tell test reporter that evaluation of a test
starts. Adapt documentation of current-test-reporter accordingly.
Use define-opt instead of case-lambda.