Factorize and optimize `write' for strings and characters.
authorLudovic Courtès <ludo@gnu.org>
Tue, 14 Sep 2010 14:10:52 +0000 (16:10 +0200)
committerLudovic Courtès <ludo@gnu.org>
Tue, 14 Sep 2010 14:11:19 +0000 (16:11 +0200)
commit07f49ac786e0f1c007eb336e2fb7a572e8405316
treeab04b1efe4ee3062959b659456b3abc53b9d1b6f
parent4ff2b9f4b6fab00e0e982ce6d1b2594c19704d6e
Factorize and optimize `write' for strings and characters.

According to `write.bm', this makes `write' 2.6 times faster for strings.

* libguile/print.c (iprin1): Use `write_character' when
  `SCM_WRITINGP (pstate)' and `SCM_CHARP (exp)' or `scm_is_string (exp)'.
  (scm_i_charprint): Remove.
  (display_character, write_character): New functions.
  (scm_write_char): Use `display_character' instead of
  `scm_i_charprint'.

* libguile/print.h (scm_i_charprint): Remove declaration.

* benchmark-suite/benchmarks/write.bm: New file.

* benchmark-suite/Makefile.am (SCM_BENCHMARKS): Add
  `benchmarks/write.bm'.
benchmark-suite/Makefile.am
benchmark-suite/benchmarks/write.bm [new file with mode: 0644]
libguile/print.c
libguile/print.h