Hello Edi
sorry for the delay. ... i'm too busy right now.
No problem, I'm not hurry.
I have a new version, with better performance (see attached diff of output.lisp against 0.11.2).
Results for the same test:
;; original flexi-streams-0.11.2 ;; =============================
(time (time-test :utf-8)) ;; Real time: 12.178 sec. ;; Run time: 12.093 sec. ;; Space: 430660 Bytes ;; GC: 1, GC time: 0.015 sec.
(time (time-test :koi8-r)) ;; Real time: 0.246 sec. ;; Run time: 0.25 sec. ;; Space: 1820584 Bytes ;; GC: 2, GC time: 0.048 sec.
;; with char-to-octets ;; ===================
(time (time-test :utf-8)) ;; Real time: 0.328 sec. ;; Run time: 0.328 sec. ;; Space: 1728432 Bytes ;; GC: 2, GC time: 0.047 sec.
(time (time-test :koi8-r)) ;; Real time: 0.323 sec. ;; Run time: 0.297 sec. ;; Space: 1728436 Bytes ;; GC: 2, GC time: 0.063 sec.
Surprising is that utf-8 works with almost equal efficiency as 8-bit encoding.
I think the difference in performance for 8-bit between this version and the original 0.11.2 is caused by two function calls instead of inlined character to bytes conversion (CLOS dispatch of CHAR-TO-OCTETS which in turn calls OCTET-SINK passed to it).
I have to think about this a bit more ... The win for UTF-8 is impressive, but I'm a bit concerned that you'll lose a lot of performance for 8-bit encodings. I think it'd be better to leave the 8-bit version in there and only use your code for other strings.
It's up to you. I hope it will be possible to inline code as you do in 0.11.2, maybe redefining CHAR-TO-OCTETS methods as macros.
Maybe I'll try it when I have some spare time.
Regards, -Anton