summaryrefslogtreecommitdiff
path: root/src/common/db.c
diff options
context:
space:
mode:
authorshennetsind <ind@henn.et>2013-12-17 23:02:13 -0200
committershennetsind <ind@henn.et>2013-12-17 23:02:13 -0200
commit38f6b2c68c59d3ed2e3fc6d4d75907939c4fdf61 (patch)
tree45b4bf49bca0ffb5fabe7405f445caa22cc215f8 /src/common/db.c
parent46a990697bdacaf3955c54e0b9d8503f3b704728 (diff)
downloadhercules-38f6b2c68c59d3ed2e3fc6d4d75907939c4fdf61.tar.gz
hercules-38f6b2c68c59d3ed2e3fc6d4d75907939c4fdf61.tar.bz2
hercules-38f6b2c68c59d3ed2e3fc6d4d75907939c4fdf61.tar.xz
hercules-38f6b2c68c59d3ed2e3fc6d4d75907939c4fdf61.zip
Speed up of several procedures that rely on ERS, _mreallocz ('z'ero)
Made Possible Thanks to the Woonderful Haruna! <3 Commit also fixes an inconsistency in the ERS, where it'd start with clear memory but would use garbage upon resizing, also implements a new ERS option that clears entries as soon as pass by ers_free, so that they'll be all shinny for when ers_alloc reuses them. Signed-off-by: shennetsind <ind@henn.et>
Diffstat (limited to 'src/common/db.c')
-rw-r--r--src/common/db.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/common/db.c b/src/common/db.c
index ba3fef97b..efe7ca8b2 100644
--- a/src/common/db.c
+++ b/src/common/db.c
@@ -2446,7 +2446,7 @@ DBMap* db_alloc(const char *file, const char *func, int line, DBType type, DBOpt
db->free_lock = 0;
/* Other */
snprintf(ers_name, 50, "db_alloc:nodes:%s:%s:%d",func,file,line);
- db->nodes = ers_new(sizeof(struct dbn),ers_name,ERS_OPT_WAIT|ERS_OPT_FREE_NAME);
+ db->nodes = ers_new(sizeof(struct dbn),ers_name,ERS_OPT_WAIT|ERS_OPT_FREE_NAME|ERS_OPT_CLEAN);
db->cmp = DB->default_cmp(type);
db->hash = DB->default_hash(type);
db->release = DB->default_release(type, options);
@@ -2609,8 +2609,8 @@ void* db_data2ptr(DBData *data)
* @see #db_final(void)
*/
void db_init(void) {
- db_iterator_ers = ers_new(sizeof(struct DBIterator_impl),"db.c::db_iterator_ers",ERS_OPT_NONE);
- db_alloc_ers = ers_new(sizeof(struct DBMap_impl),"db.c::db_alloc_ers",ERS_OPT_NONE);
+ db_iterator_ers = ers_new(sizeof(struct DBIterator_impl),"db.c::db_iterator_ers",ERS_OPT_CLEAN);
+ db_alloc_ers = ers_new(sizeof(struct DBMap_impl),"db.c::db_alloc_ers",ERS_OPT_CLEAN);
ers_chunk_size(db_alloc_ers, 50);
DB_COUNTSTAT(db_init);
}