Just pushed a few more changes. I wrote a simple benchmark which just involved reading 97800 symbols from a file. (The symbols were already interned). Before these latest changes, the median speed was 13872 symbols per second. These last changes put us at 14662 symbols per second. (For comparison, the C version can only read 2000 symbols per second)
I think there's only another 5% improvement that would be easy to get, but it's not worth it. On Tue, Nov 24, 2009 at 10:40 AM, Joe Marshall <[email protected]> wrote: > On Tue, Nov 24, 2009 at 10:21 AM, Taylor R Campbell <[email protected]> > wrote: >> Date: Tue, 24 Nov 2009 09:37:39 -0800 >> From: Joe Marshall <[email protected]> >> >> It turns out that when you read a source code file that the >> inner loop of the parser does a lot of superfluous checking >> of PORT? Although PORT? is an inexpensive operation, >> it still involves an out-of-line call, and it gets called eleven times >> for each character of input. >> >> Hmm... How about caching the values of (port/operation/read-char >> port) and (port/operation port 'DISCRETIONARY-WRITE-CHAR) in the db, >> which should also avoid some ASSQ calls? > > Here's what I've got so far: > (View in fixed-width. Left column is original, right column is changes so > far.) > > read-unquoted read-unquoted > #[unnamed-procedure] > #[unnamed-procedure] > peek-char %peek-char > #[let-procedure] #[let-procedure] > #[internal-lambda] > #[internal-lambda] > loop loop > input-port/peek-char > port/operation/peek-char > port/type > port? *** > #[unnamed-procedure] > #[unnamed-procedure] > generic-io/peek-char > generic-io/peek-char > generic-io/read-char > generic-io/read-char > port/state port/state > port? *** port? > reset-prev-char reset-prev-char > #[let-procedure] #[let-procedure] > #[internal-lambda] > #[internal-lambda] > loop loop > read-next-char read-next-char > #[unnamed-procedure] > #[unnamed-procedure] > decode-char decode-char > #[unnamed-procedure] > #[unnamed-procedure] > port/state port/state > port? *** port? > transcribe-input-char > transcribe-input-char > transcribe-char transcribe-char > eof-object? eof-object? > char-set-member? char-set-member? > char-set? char-set? > %char-set-member? > %char-set-member? > guarantee-constituent > guarantee-constituent > char-set-member? char-set-member? > char-set? char-set? > %char-set-member? > %char-set-member? > #[unnamed-procedure] > #[unnamed-procedure] > read-char %read-char > port/operation > port-type/%operation > port/type > port? *** > port-type/operation > guarantee-port-type > port-type? > assq assq > #[let-procedure] #[let-procedure] > #[internal-lambda] > #[internal-lambda] > loop loop > loop loop > loop loop > #[let-procedure] #[let-procedure] > #[internal-lambda] > #[internal-lambda] > loop loop > input-port/read-char > port/operation/read-char > port/type > port? *** > #[unnamed-procedure] > #[unnamed-procedure] > operation/read-char > operation/read-char > generic-io/read-char > generic-io/read-char > port/state port/state > port? *** port? > reset-prev-char reset-prev-char > #[let-procedure] #[let-procedure] > #[internal-lambda] > #[internal-lambda] > loop loop > read-next-char read-next-char > #[unnamed-procedure] > #[unnamed-procedure] > decode-char decode-char > #[unnamed-procedure] > #[unnamed-procedure] > eof-object? eof-object? > transcribe-input-char > transcribe-input-char > #[let-procedure] #[let-procedure] > operation/discretionary-write-char > operation/discretionary-write-char > #[unnamed-procedure] > #[unnamed-procedure] > port/state port/state > port? *** port? > char-downcase char-downcase > %char-downcase %char-downcase > optional-output-port > guarantee-output-port > output-port? > port? *** > output-port/write-char %write-char > port/operation/write-char > port/type > port? *** > #[unnamed-procedure] > #[unnamed-procedure] > narrow-out/write-char > narrow-out/write-char > port/state port/state > port? *** port? > maybe-grow-buffer > maybe-grow-buffer > #[let-procedure] #[let-procedure] > wide-string? wide-string? > new-column new-column > transcribe-char transcribe-char > output-port/discretionary-flush > port/operation/discretionary-flush-output > port/type > port? *** > #[unnamed-procedure] > #[unnamed-procedure] > no-flush no-flush > discretionary-flush-transcript > discretionary-flush-transcript > > I'll get to the ASSQ call when it is a larger proportion of the calls. > I have to fix port/state first. > > -- > ~jrm > -- ~jrm
_______________________________________________ MIT-Scheme-devel mailing list [email protected] http://lists.gnu.org/mailman/listinfo/mit-scheme-devel
