[ANN] teepeedee2 — fastest web-server in LISP
От: Mamut Швеция http://dmitriid.com
Дата: 26.05.09 06:34
Оценка: 20 (2)
http://john.freml.in/teepeedee2-release

Некто John Fremlin выпустил веб-сервер, написаный строго на Common Lisp'е, без использования сторонних библиотек на С.

Презентация с бенчмарками: http://tlug.jp/meetings/2008/11/serving-dynamic-webpages-in-less-then-a-millisecond_john-fremlin_handout.pdf Автор утверждает, что его веб-сервер супербыстрый, правда цифра 3806.90 requests/second для генерации <h1>Hello NAME</h1> меня лично не впечатлила

Код: http://github.com/vii/teepeedee2/tree/master

Предлагает некоторые плюшки, типа генерация html-кода с проверкой на валидность, генерация Javascript-кода.

Любителям LISP'а должно понравиться

ЗЫ. Блог Фремлина работает поверх этого веб-сервера. Вот весь код для блога:
(in-package #:tpd2.blog)
 
(defun tech-css ()
  (css-html-style 
    ((".inherit" <input <a)
     :text-decoration "inherit" :color "inherit" :background-color "inherit" :font-size "inherit" :font-weight "inherit"
     :font-family "inherit" 
     :border "none" :padding "0 0 0 0" :margin "0 0 0 0")
    ((<body "h1.title")
      :margin "0 0 0 0"
      :padding "0 0 0 0")
    (<body
      :font-family "georgia, serif"
      :font-weight "lighter"
      :color "black"
      :background-color "white")
    ("[onclick]" :cursor "pointer")
    (".blog-entry-post-comment [onclick]"
     :text-decoration "underline")
    ("div.comment:first-child" 
     :margin-top "3em")
    (".blog-entry"
     :margin-left "2em"
     :margin-right "2em")
    (".blog-entry-story, .blog-entry-comments"
     :font-size "1.3em"
     :x-column-width "30em"
     :x-column-gap "2em")
    (".blog-entry-story P + P"
     :text-indent "1em")
    (".blog-entry-story A"
     :text-decoration "underline")
    (".blog-entry-story P"
     :line-height "1.6em")
    ((<h1 <h2 <h3 <h4)
      :font-family "verdana, sans-serif"
      :font-weight "lighter"
      :font-stretch "narrower"
      :letter-spacing "0.09em"
     :margin-left "1em"
     :margin-right "1em")
    (<h2 :font-size "200%")
    ("h1.title"
      :padding-top "1em"
      :text-align "right"
      :font-size "300%"
      :color "white"
      :background-color "rgb(76,6,81)")
    (".blog-entry-post-comment textarea" 
      :width "100%"
      :height "30em")
    (".time"
     :x-opacity 0.60
     :margin-right "16%"
     :text-align "right"
     :font-size "50%")
    (".time .author"
     :font-size "200%")
    (".blog-entry-post-comment [name=AUTHOR]" 
     :border-bottom "thin solid")))
(defsite *tech-blog-site*
    :dispatcher "127.0.0.1:11111"
    :page-body-start (lambda(title)
               `(<div :class "header"                      
                  (<h1 :class "title" (<a :href "/" (output-raw-ml ,title)))))
    :page-head (lambda(title)
         `(with-ml-output
           (<title (output-raw-ml ,title))
           (tech-css)
           (webapp-default-page-head-contents))))
(defparameter *tech* 
  (make-blog 
   :link-base "/" 
   :comment-index-prefix "vii" 
   :name "John Fremlin's blog" :dir "...." :static-base-url "/static-blog/" :site *tech-blog-site*
   :admin-password-file "...."))
(defun read-in-blog ()
  (blog-read-in *tech*))
(in-package #:teepeedee2)
#.(when (find-package :swank)
    (push :tpd2-has-swank *features*)
    nil)
(defun run-thread (name function)
  (with-preserve-specials (*trace-output* *standard-output* *error-output* *debug-io* 
                     #+tpd2-has-swank swank::*emacs-connection*)
    (flet ((func ()
         (with-specials-restored
         (funcall function))))
      #+sbcl
      (sb-thread:make-thread #'func :name name)
      #+ccl
      (ccl:process-run-function name #'func))))
(loop for port in '(11111) do
      (let ((socket (tpd2.io:make-con-listen :port port)))
    (tpd2.io:launch-io 'tpd2.io:accept-forever socket 'tpd2.http::http-serve)))
(run-thread "read in blog" (lambda()
                  (loop do
                    (tpd2.blog::read-in-blog)
                    (sleep 300))))
(run-thread "tpd2.io:event-loop" (lambda()
                   (tpd2.datastore:datastore-use-file "datastore.log")
                   (tpd2.io:event-loop)))
avalon 1.0rc1 rev 239, zlib 1.2.3


dmitriid.comGitHubLinkedIn
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.