Re: readline()

2008-12-05 Thread Alexander Burger
On Fri, Dec 05, 2008 at 07:24:47AM +0100, Alexander Burger wrote:
> What remains is the nasty feature that readline() does not obey the
> line's starting column. It should start at column 2 (because PicoLisp
> issues its own prompt ": ").

OK, found it!

Here is the current implementation:


# 05dec08abu
# (c) Software Lab. Alexander Burger

(load "@lib/gcc.l")

(gcc "readline" '("-lreadline") '_led)

#include 
#include 

any _led(any ex __attribute__((unused))) {
   char *p;
   any x;

   rl_already_prompted = YES;
   if ((p = readline(": ")) && *p)
  add_history(p);
   x = mkStr(p);
   free(p);
   return x;
}

/**/

# Enable line editing
(de *Led (_led))

# vi:et:ts=3:sw=3


Implementing TAB-completion is left as an exercise to the user :-)

Cheers,
- Alex
-- 
UNSUBSCRIBE: mailto:[EMAIL PROTECTED]


Re: database contest article

2008-12-05 Thread Alexander Burger
Hi Tomas,

> I just tried to roughly benchmark the forking server and I do not
> think it is a limiting factor.  With the following code

That's right. For a database benchmark it is not a limiting factor, this
will be more on the db side.

However, if I try a non-forking server


#!bin/picolisp lib.l

(load "ext.l" "lib/http.l" "lib/xhtml.l")

(allowed () "@start")

(de start ()
   (html 0 "Hello" NIL NIL
  "Hello World!" ) )

(let (P (port 8080)  H "@start")
   (setq *Home (cons H (chop H)))
   (loop
  (when (listen P)
 (http @)
 (close @) ) ) )


I get roughly three times as many transactions, compared to the forking
server. I also did

   $ siege -b -c 5 http://localhost:8080


But, as we saw already, this is only for an "empty" server. For real
applications the difference will be neglectible, especially as the fork
occurs only once for each session.

Cheers,
- Alex
-- 
UNSUBSCRIBE: mailto:[EMAIL PROTECTED]