Performance tweaks

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@12526 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2002-02-13 18:49:32 +00:00
parent 84c45257a4
commit 77c70d4df7
9 changed files with 35 additions and 1 deletions

View file

@ -3,7 +3,16 @@
* Source/NSString.m: ([stringByExpandingTildeInPath]) fix bug in
handling ~username/... format.
* Headers/Foundation/GSIMap.h: GSIMapCleanMap() rewrote to empty
the map efficiently.
the map efficiently. Added an option to refrain from calling it
when emptying a map that doesn't need keys and values releasing.
* Source/GSAttributedString.m: don't clean maps on emptying.
* Source/GSFFCallInvocation.m: ditto
* Source/NSArchiver.m: ditto
* Source/NSConnection.m: ditto
* Source/NSObject.m: ditto
* Source/NSPortCoder.m: ditto
* Source/NSSerializer.m: ditto
Changes inspired by Pierre-Tves Rivaille
2002-02-12 Richard Frith-Macdonald <rfm@gnu.org>

View file

@ -65,6 +65,12 @@
* map table whose type is that specified by the value of the
* preprocessor constant. This field can be used
* to store additional information for the map.
*
* GSI_MAP_NOCLEAN
* Define this to a non-zero integer value if the map keys and
* values do not need to be released when the map is emptied.
* This permits some optimisation.
*
*/
#ifndef GSI_MAP_HAS_VALUE
@ -731,7 +737,19 @@ GSIMapEmptyMap(GSIMapTable map)
{
int i;
#ifdef GSI_MAP_NOCLEAN
if (GSI_MAP_NOCLEAN)
{
map->firstNode = 0;
map->nodeCount = 0;
}
else
{
GSIMapCleanMap(map);
}
#else
GSIMapCleanMap(map);
#endif
if (map->buckets != 0)
{
NSZoneFree(map->zone, map->buckets);

View file

@ -99,6 +99,7 @@
#define GSI_MAP_EQUAL(M, X,Y) [(X).obj isEqualToDictionary: (Y).obj]
#define GSI_MAP_KTYPES GSUNION_OBJ
#define GSI_MAP_VTYPES GSUNION_INT
#define GSI_MAP_NOCLEAN 1
#include <base/GSIMap.h>

View file

@ -112,6 +112,7 @@ ReturnTypeEqualsReturnType (vacallReturnTypeInfo *a, vacallReturnTypeInfo *b)
#define GSI_MAP_RETAIN_VAL(M, X)
#define GSI_MAP_RELEASE_KEY(M, X)
#define GSI_MAP_RELEASE_VAL(M, X)
#define GSI_MAP_NOCLEAN 1
#include <base/GSIMap.h>

View file

@ -34,6 +34,7 @@
#define GSI_MAP_RELEASE_VAL(M, X)
#define GSI_MAP_HASH(M, X) ((X).uint)
#define GSI_MAP_EQUAL(M, X,Y) ((X).uint == (Y).uint)
#define GSI_MAP_NOCLEAN 1
#include <base/GSIMap.h>

View file

@ -43,6 +43,7 @@
#define GSI_MAP_RELEASE_VAL(M, X)
#define GSI_MAP_HASH(M, X) ((X).uint ^ ((X).uint >> 3))
#define GSI_MAP_EQUAL(M, X,Y) ((X).ptr == (Y).ptr)
#define GSI_MAP_NOCLEAN 1
#include <base/GSIMap.h>

View file

@ -233,6 +233,7 @@ NSDecrementExtraRefCountWasZero(id anObject)
#define GSI_MAP_RELEASE_VAL(M, X)
#define GSI_MAP_KTYPES GSUNION_OBJ|GSUNION_INT
#define GSI_MAP_VTYPES GSUNION_INT
#define GSI_MAP_NOCLEAN 1
#include <base/GSIMap.h>

View file

@ -55,6 +55,7 @@
#define GSI_MAP_RELEASE_VAL(M, X)
#define GSI_MAP_HASH(M, X) ((X).uint)
#define GSI_MAP_EQUAL(M, X,Y) ((X).uint == (Y).uint)
#define GSI_MAP_NOCLEAN 1
#include <base/GSIMap.h>

View file

@ -56,6 +56,7 @@
#define GSI_MAP_RELEASE_VAL(M, X)
#define GSI_MAP_HASH(M, X) [(X).obj hash]
#define GSI_MAP_EQUAL(M, X,Y) [(X).obj isEqualToString: (Y).obj]
#define GSI_MAP_NOCLEAN 1
#include <base/GSIMap.h>