Ok, I figured out a fix (attached).
write_symbol_string was attempting to use some kind of buffering similar to writestr_stream in file.d, which buffering I replaced with calls to ecl_write_char.
This simplified the code, and does not seem to have had a noticeable negative effect on the performance of printing symbols:
--8<---------------cut here---------------start------------->8---
(defvar j (read-from-string "абракадабра"))
J
(time (dotimes (i 1000000) (with-output-to-string (x1) (print j x1))))
--8<---------------cut here---------------end--------------->8---
Before:
real time : 5.349 secs run time : 6.827 secs gc count : 552 times consed : 1055997968 bytes NIL
After:
real time : 5.278 secs run time : 7.756 secs gc count : 257 times consed : 1039999200 bytes NIL
-- Vladimir Sedach Software engineering services in Los Angeles https://oneofus.la