|
About ::
TODO ::
Blog ::
RSS ::
Old blog ::
Projects ::
GIT ::
Gallery ::
Notes
Thu, 09 Nov 2006
POSIX threading model vs. Erlang threads. Erlang : 0.443 seconds C++/POSIX NPTL threads 1 : 4.374 seconds C++/POSIX NPTL threads 2 : 0.190 secondsi.e. C++ application which uses POSIX NPTL threads is about 10 (!) times slower than native Erlang threads, but if thread start/stop functions are written in assembler (if I did not forget it completely), C++ variant becomes 2 times faster than Erlang's one, which seems to be either real magic, or some bug. I understand that Erlang has completely differet thread model (i.e. it is part of it's virtual machine, but not system as a whole), but there is major issue to think about. Eventually I created own application, which uses NPTL POSIX threads, which I compared to above (this (1)). Above numbers are the best numbers reported by time test, so I put gettimeofday()
inside main() in both C++ and my C versions and run them 13 times.Here are averaged results: C++/POSIX NPTL threads 1 : 5083343 usecs C/POSIX NPTL threads : 4821212 usecs C++/POSIX NPTL threads 1 (-fomit-frame-pointer) : 4738057 usecs C/POSIX NPTL threads (-fomit-frame-pointer) : 4430010 usecsSources are available here. Compilation options were: -pipe -Wall -O3 -lpthread -fomit-frame-pointerThis is definitely an issue to think about... /devel/other :: Link / Comments () |