Mercurial > urweb
changeset 2085:fd6d362666c0
Optimizing writes of single characters
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Thu, 04 Dec 2014 19:54:04 -0500 (2014-12-05) |
parents | 0d48cfb59b29 |
children | 3d22f761a4b7 |
files | include/urweb/urweb_cpp.h src/c/urweb.c src/mono_opt.sml |
diffstat | 3 files changed, 8 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/include/urweb/urweb_cpp.h Thu Dec 04 02:47:24 2014 -0500 +++ b/include/urweb/urweb_cpp.h Thu Dec 04 19:54:04 2014 -0500 @@ -396,4 +396,6 @@ int uw_remoteSock(struct uw_context *); void uw_set_remoteSock(struct uw_context *, int sock); +void uw_Basis_writec(struct uw_context *, char); + #endif
--- a/src/c/urweb.c Thu Dec 04 02:47:24 2014 -0500 +++ b/src/c/urweb.c Thu Dec 04 19:54:04 2014 -0500 @@ -1659,6 +1659,10 @@ uw_writec_unsafe(ctx, c); } +void uw_Basis_writec(uw_context ctx, char c) { + uw_writec(ctx, c); +} + static void uw_write_unsafe(uw_context ctx, const char* s) { int len = strlen(s); memcpy(ctx->page.front, s, len);
--- a/src/mono_opt.sml Thu Dec 04 02:47:24 2014 -0500 +++ b/src/mono_opt.sml Thu Dec 04 19:54:04 2014 -0500 @@ -626,6 +626,8 @@ EFfiApp ("Basis", "attrifyChar", [e]) | EFfiApp ("Basis", "attrifyString_w", [((EFfiApp ("Basis", "str1", [e]), _), _)]) => EFfiApp ("Basis", "attrifyChar_w", [e]) + | EWrite (EFfiApp ("Basis", "str1", [e]), _) => + EFfiApp ("Basis", "writec", [e]) | EBinop (_, "+", (EPrim (Prim.Int n1), _), (EPrim (Prim.Int n2), _)) => EPrim (Prim.Int (Int64.+ (n1, n2)))