diff options
author | Warren Dukes <warren.dukes@gmail.com> | 2004-11-11 04:34:26 +0000 |
---|---|---|
committer | Warren Dukes <warren.dukes@gmail.com> | 2004-11-11 04:34:26 +0000 |
commit | 21b5cde43ac7c82b1848145456b98e2c5b8e6cb1 (patch) | |
tree | 12a873c1586191a39356a7822692e841fa61508a /src/dbUtils.c | |
parent | 6e0c4369c37df64764e3aaa49365d6560a3a3806 (diff) | |
download | mpd-21b5cde43ac7c82b1848145456b98e2c5b8e6cb1.tar.gz mpd-21b5cde43ac7c82b1848145456b98e2c5b8e6cb1.tar.xz mpd-21b5cde43ac7c82b1848145456b98e2c5b8e6cb1.zip |
ok, optimize memory sage of directorys, by iteratively creating the directories,
this code needs some serious testing:
Note:
The song name optimization i think is worth it, saves about 200k of ram on my syste, however, having to create directory names iteratively each time we print probably isn't worth the cpu. We only save about 10k of ram for the computer todo alot more work, and the code maybe a little messier
git-svn-id: https://svn.musicpd.org/mpd/trunk@2604 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r-- | src/dbUtils.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/dbUtils.c b/src/dbUtils.c index 3699ab72a..51e991130 100644 --- a/src/dbUtils.c +++ b/src/dbUtils.c @@ -60,8 +60,8 @@ int countSongsInDirectory(FILE * fp, Directory * directory, void * data) { } int printDirectoryInDirectory(FILE * fp, Directory * directory, void * data) { - if(directory->utf8name) { - myfprintf(fp,"directory: %s\n",directory->utf8name); + if(directory->name) { + myfprintf(fp,"directory: %s\n", getDirectoryPath(directory)); } return 0; } @@ -273,13 +273,15 @@ int listAllUniqueTags(FILE * fp, int type, int numConditionals, int sumSavedMemoryInDirectory(FILE * fp, Directory * dir, void * data) { int * sum = data; - if(!dir->utf8name) return 0; + if(!dir->name) return 0; - *sum += (strlen(dir->utf8name)+1-sizeof(Directory *))* + *sum += (strlen(getDirectoryPath(dir))+1-sizeof(Directory *))* dir->songs->numberOfNodes; - /**sum += (strlen(dir->utf8name)+1)* - dir->subDirectories->numberOfNodes;*/ + *sum += (strlen(getDirectoryPath(dir))+1)* + dir->subDirectories->numberOfNodes; + + *sum += strlen(dir->name)+1; return 0; } |