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)))
M>http://john.freml.in/teepeedee2-release
M>Некто John Fremlin выпустил веб-сервер, написаный строго на Common Lisp'е, без использования сторонних библиотек на С.
Обсуждение на слешдоте:
http://slashdot.org/comments.pl?sid=1244601
Из комемнтариев: "First, his blog is standing up to a slashdotting. That's impressive."
T>Обсуждение на слешдоте: http://slashdot.org/comments.pl?sid=1244601
T>Из комемнтариев: "First, his blog is standing up to a slashdotting. That's impressive."
Обсуждение, кстати, интересное.
Уже подняли тему DSL супротив библиотек.
t> T>Обсуждение на слешдоте: http://slashdot.org/comments.pl?sid=1244601
t> T>Из комемнтариев: "First, his blog is standing up to a slashdotting. That's impressive."
t> Обсуждение, кстати, интересное.
На удивление
t> Уже подняли тему DSL супротив библиотек.
Что-то я не понимаю, как у них система отображения комментов рабоатет. ПРо DSL'и против библиотек не увидел
t>> Уже подняли тему DSL супротив библиотек.
M>Что-то я не понимаю, как у них система отображения комментов рабоатет. ПРо DSL'и против библиотек не увидел
http://slashdot.org/comments.pl?sid=1244601&cid=28088457
Yes, you can use macros to enable extremely high level of code reuse, effectively 100% (if theres any kind of pattern in your code, you can write a macro to encapsulate that). But it also means that you're effectively defining your own DSL, and then writing your program in that — and when someone else needs to understand and maintain your code, they'll have to figure out that DSL first.
This isn't really fundamentally different from plain function/class libraries (they are also DSLs), but the expressivity of macros is so much higher than plain function calls (even with Smalltalk/Ruby style blocks and other such facilities) — and, consequently, so is their complexity.
On Tue, 26 May 2009 11:29:45 GMT, Mamut wrote:
M> Что-то я не понимаю, как у них система отображения комментов
M> рабоатет. ПРо DSL'и против библиотек не увидел
Там на h-j-k-l навигация висит, вроде довольно удобно читать.
Posted via RSDN NNTP Server 2.1 beta