From owner-freebsd-stable@FreeBSD.ORG Tue May 6 00:43:15 2008 Return-Path: Delivered-To: stable@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 711B5106564A for ; Tue, 6 May 2008 00:43:15 +0000 (UTC) (envelope-from bfriesen@simple.dallas.tx.us) Received: from scooby.simplesystems.org (scooby.simplesystems.org [65.66.246.67]) by mx1.freebsd.org (Postfix) with ESMTP id 40E7C8FC0A for ; Tue, 6 May 2008 00:43:14 +0000 (UTC) (envelope-from bfriesen@simple.dallas.tx.us) Received: from freddy.simplesystems.org (freddy.simplesystems.org [65.66.246.65]) by scooby.simplesystems.org (8.12.10+Sun/8.12.10) with ESMTP id m460NgCI029430; Mon, 5 May 2008 19:23:42 -0500 (CDT) Date: Mon, 5 May 2008 19:23:42 -0500 (CDT) From: Bob Friesenhahn X-X-Sender: bfriesen@freddy.simplesystems.org To: stable@FreeBSD.org Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: Subject: static vs shared vs modules X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 May 2008 00:43:15 -0000 Mikhail Teterin requested that I forward this tidbit of info to the list. The GraphicsMagick build currently distributed with FreeBSD 7.0 uses shared libraries but not loadable modules. Some testing I did today shows that FreeBSD is much slower at starting GraphicsMagick as a large static executable (with shared lib dependencies) than it is for a shared library, which itself much slower than the case where parts of the needed code are loaded using modules. This may imply that FreeBSD is abnormally slow at initializing large applications (e.g. Solaris 10 does not exhibit this anomaly since timings vary only by a few percent). For the timings below, I execute the command using this simple shell script: #!/bin/bash i=1 count=1000 time while test $i -lt $count do eval "$@" let i=i+1 done Here is the original email content sent to Mikhail Teterin: I performed some timings for executing a minimal GraphicsMagick command 'gm convert -size 1x1 'xc:#F00' null:' 1000 times. This is under FreeBSD. Static build: real 0m39.558s user 0m24.825s sys 0m14.853s Shared build: real 0m27.828s user 0m18.367s sys 0m9.728s Modules build: real 0m11.041s user 0m4.785s sys 0m6.737s I find it interesting that FreeBSD is not very efficient at starting large (mostly) static programs. Solaris is a lot better at this. Probably much of the difference in performance has to do with how the run-time linker works, and the amount of initialized data which needs to be set. With the static build I can push the generated image size to to 500x500 without much impact on the total run time. The execution overhead is that great. These differences may seem small but if gm is invoked from a simple shell script, it can make the difference between processing 25 small images per second or 90 images per second. Also, the consumed user and system time is dramatically less. Bob ====================================== Bob Friesenhahn bfriesen@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/ GraphicsMagick Maintainer, http://www.GraphicsMagick.org/