[devel] version script for libdb4.3

Dmitry V. Levin =?iso-8859-1?q?ldv_=CE=C1_altlinux=2Eorg?=
Сб Окт 8 01:41:12 MSD 2005


On Mon, Sep 05, 2005 at 01:48:19AM +0400, Dmitry V. Levin wrote:
[...]
> убирание ненужных символов даёт стабилизацию использования и рост скорости
> запуска.  На том же libdb4.3 выигрыш умопомрачительный.

Немного цифр:

$ ls -log {old,new}/libdb-4.3.so 
-rw-r--r--  1 854016 Окт  8 00:17 new/libdb-4.3.so
-rw-r--r--  1 936160 Июн 15 22:31 old/libdb-4.3.so

$ nm -D old/libdb-4.3.so |grep -c '^[0-9a-f]'
1431
$ nm -D new/libdb-4.3.so |grep -c '^[0-9a-f]'
51

$ rm -f my_db.db && env -i LD_DEBUG=statistics LD_LIBRARY_PATH=old ./db_create
     12345:	                 number of relocations: 632
     12345:	      number of relocations from cache: 6
     12345:	        number of relative relocations: 1593
     12345:	
     12345:	runtime linker statistics:
     12345:	           final number of relocations: 748
     12345:	final number of relocations from cache: 6
$ rm -f my_db.db && env -i LD_DEBUG=statistics LD_LIBRARY_PATH=new ./db_create
     12345:	                 number of relocations: 106
     12345:	      number of relocations from cache: 5
     12345:	        number of relative relocations: 2120
     12345:	
     12345:	runtime linker statistics:
     12345:	           final number of relocations: 139
     12345:	final number of relocations from cache: 5

$ env -i LD_LIBRARY_PATH=old time sh -c 'rm -f my_db.db; for i in `seq 10000`; do ./db_create; done'
5.53user 4.15system 0:09.68elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (1920466major+361627minor)pagefaults 0swaps
$ env -i LD_LIBRARY_PATH=new time sh -c 'rm -f my_db.db; for i in `seq 10000`; do ./db_create; done'
2.82user 3.91system 0:06.72elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (1750466major+351627minor)pagefaults 0swaps


-- 
ldv
----------- следующая часть -----------
/* Taken from /usr/share/doc/db-4.3.28/gsg/C/DB.html */

#include <db.h>

int
main(void)
{
	DB     *dbp;		/* DB structure handle */
	u_int32_t flags;	/* database open flags */
	int     ret;		/* function return value */

	/* Initialize the structure. This                                                                            
	 * database is not opened in an environment,                                                                 
	 * so the environment pointer is NULL. */
	ret = db_create(&dbp, NULL, 0);
	if (ret != 0)
	{
		/* Error handling goes here */
		return 1;
	}

	/* Database open flags */
	flags = DB_CREATE;	/* If the database does not exist,                                                     
				 * create it.*/

	/* open the database */
	ret = dbp->open(dbp,	/* DB structure pointer */
			NULL,	/* Transaction pointer */
			"my_db.db",	/* On-disk file that holds the database. */
			NULL,	/* Optional logical database name */
			DB_BTREE,	/* Database access method */
			flags,	/* Open flags */
			0);	/* File mode (using defaults) */
	if (ret != 0)
	{
		/* Error handling goes here */
		return 1;
	}
	return 0;
}
----------- следующая часть -----------
Было удалено вложение не в текстовом формате...
Имя     : =?iso-8859-1?q?=CF=D4=D3=D5=D4=D3=D4=D7=D5=C5=D4?=
Тип     : application/pgp-signature
Размер  : 189 байтов
Описание: =?iso-8859-1?q?=CF=D4=D3=D5=D4=D3=D4=D7=D5=C5=D4?=
Url     : <http://lists.altlinux.org/pipermail/devel/attachments/20051008/9a509481/attachment-0001.bin>


Подробная информация о списке рассылки Devel