Mike Gran writes: > I can't imagine any possible way that this patch could make > performance worse, but, it is in the very core of the ports. >   > I don't think you can get away without at least a bit of > profiling. Fair enough. First of all, this patch reduces the size of the built libguile.so by about 42 kilobytes, and libguile.a by about 96 kilobytes. As for performance: the updated patches (attached below) slows things down by about one quarter of one percent on my machine. The specific benchmark I did was to call 'read-string' on an 11 megabyte ASCII text file, with the port-encoding set to UTF-8. In this case, all the reads are done using 'scm_get_byte_or_eof' (called from 'get_utf8_codepoint'). So I think this is an acceptable cost for such a great reduction in code size. What do you think? Thanks for nudging me to do the measurement. To be honest, the original patch I posted slowed things down by 4.5%, which I found extremely surprising. I fixed it by adding an internal 'static' version of 'scm_fill_input'. So for those who doubt the cost of function calls though the shared library PLT (which, within a shared library, is *every* function call to a non-static function), let this be a lesson. That's the only thing that changed here, and it made more than a 4% difference, even though the procedure call in question was done only once per 4 kilobyte buffer! Here's the raw data: before: 12767060 libguile-2.0.a 6999271 libguile-2.0.so.22.6.0 after: 12671162 libguile-2.0.a (96 kbytes smaller) 6956989 libguile-2.0.so.22.6.0 (42 kbytes smaller) test file (the contents of 'psyntax.scm' repeated many times): -rw-r--r-- 1 mhw mhw 11503780 Apr 2 12:46 /home/mhw/BIG-FILE before: scheme@(guile-user)> ,time (define s (call-with-input-file "/home/mhw/BIG-FILE" read-string)) ;; 2.953214s real time, 2.951423s run time. 0.027767s spent in GC. scheme@(guile-user)> ,time (define s (call-with-input-file "/home/mhw/BIG-FILE" read-string)) ;; 2.942170s real time, 2.940581s run time. 0.011873s spent in GC. scheme@(guile-user)> ,time (define s (call-with-input-file "/home/mhw/BIG-FILE" read-string)) ;; 2.954309s real time, 2.950164s run time. 0.011952s spent in GC. avg: 2.9473893333333336 after: scheme@(guile-user)> ,time (define s (call-with-input-file "/home/mhw/BIG-FILE" read-string)) ;; 2.964777s real time, 2.957597s run time. 0.012116s spent in GC. scheme@(guile-user)> ,time (define s (call-with-input-file "/home/mhw/BIG-FILE" read-string)) ;; 2.971099s real time, 2.968656s run time. 0.012020s spent in GC. scheme@(guile-user)> ,time (define s (call-with-input-file "/home/mhw/BIG-FILE" read-string)) ;; 2.942377s real time, 2.940015s run time. 0.012085s spent in GC. avg: 2.9554226666666663 0.27% slower I've attached the new patches. Okay to push now? Thanks, Mark