From 688ccb8a140ef037f58bafbf35c41cb67e84a794 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Wed, 31 Oct 2007 19:04:13 -0500 Subject: [PATCH] Optimize the way random IDs are generated for the callback responder It's about 10x more efficient this way --- extra/http/server/responders/callback/callback.factor | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/extra/http/server/responders/callback/callback.factor b/extra/http/server/responders/callback/callback.factor index 12033503c1..6a5e32d32f 100644 --- a/extra/http/server/responders/callback/callback.factor +++ b/extra/http/server/responders/callback/callback.factor @@ -2,8 +2,7 @@ ! Copyright (C) 2006 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: html http http.server.responders io kernel math namespaces -continuations random system sequences assocs ; - +prettyprint continuations random system sequences assocs ; IN: http.server.responders.callback #! Name of the variable holding the continuation used to exit @@ -58,7 +57,7 @@ TUPLE: request stream exitcc method url raw-query query header response ; : get-random-id ( -- id ) #! Generate a random id to use for continuation URL's - "ID" 32 [ drop 9 random CHAR: 0 + ] map append ; + 4 big-random unparse ; : callback-table ( -- ) #! Return the global table of continuations