[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
The dynamic stack
From: |
Andy Wingo |
Subject: |
The dynamic stack |
Date: |
Sat, 03 Mar 2012 17:25:58 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) |
Hi,
I have pushed a patch to master that changes the implementation of the
dynamic stack from being a linked list on the heap to being an actual
stack. This allows us to push items on the stack in many cases without
allocating memory at all.
This has become particularly important in `master', because ports in
master have a similar locking discipline as stdio ports in glibc. (See
"Streams and Threads" in the libc manual, for more.) The upshot is that
there's a lot more scm_dynwind_pthread_mutex_lock in master, and that
was slowing things down noticeably.
This patch makes a simple "guile examples/web/debug-sxml.scm" server go
from serving 3215 reqs/s to 3830 reqs/s. (Using "ab -n 100000 -c100
http://localhost:8080/" on the same machine to test; the machine is my
laptop. By way of comparison, stable-2.0 does 3225 reqs/s on that
benchmark.)
Still, there are some things we can do to improve matters, especially
with regards to prompts. If instead of storing a cookie, the VM did a
setjmp() on entry, we could avoid allocating a jmpbuf for each prompt.
This could bring some other code simplifications, notably, the cleanup
of partial_cont_call.
Anyway, these are disconnected ramblings. Review is welcome; I'll try
to incorporate any feedback. Cheers!
Andy
--
http://wingolog.org/
- The dynamic stack,
Andy Wingo <=