diff options
author | mfederico <mfederico@1f5c12ca-751b-0410-a591-d2e778427230> | 2006-08-16 07:20:44 +0400 |
---|---|---|
committer | mfederico <mfederico@1f5c12ca-751b-0410-a591-d2e778427230> | 2006-08-16 07:20:44 +0400 |
commit | be6b9d8ce586034c3e0f4df700cdda890805d94f (patch) | |
tree | d3b15cbde6436545dd3ecf08de6d4ff5d68e7d10 /irstlm/src/ngramcache.cpp | |
parent | 0aaf45fd98e036c61c4aa32ec5922f055d4019ad (diff) |
Tuning of cache values
git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@766 1f5c12ca-751b-0410-a591-d2e778427230
Diffstat (limited to 'irstlm/src/ngramcache.cpp')
-rw-r--r-- | irstlm/src/ngramcache.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/irstlm/src/ngramcache.cpp b/irstlm/src/ngramcache.cpp index 271be4cf1..3b4234bcc 100644 --- a/irstlm/src/ngramcache.cpp +++ b/irstlm/src/ngramcache.cpp @@ -35,7 +35,7 @@ ngramcache::ngramcache(int n,int size,int maxentries){ maxn=maxentries; entries=0; ht=new htable(maxn * 2, ngsize * sizeof(int),INT,NULL); //lower load factor to reduce collisions - mp=new mempool(ngsize * sizeof(int)+infosize,maxn/5); + mp=new mempool(ngsize * sizeof(int)+infosize,1000000); accesses=0; hits=0; }; @@ -47,15 +47,19 @@ ngramcache::~ngramcache(){ }; -void ngramcache::reset(){ +//resize cache to specified number of entries +void ngramcache::reset(int n){ ht->stat(); - delete ht;delete mp; + delete ht;delete mp; + if (n>0) maxn=n; ht=new htable(maxn * 2, ngsize * sizeof(int),INT,NULL); //load factor 2 - mp=new mempool(ngsize * sizeof(int)+infosize,maxn/5); + mp=new mempool(ngsize * sizeof(int)+infosize,1000000); entries=0; } + + char* ngramcache::get(const int* ngp,char* info){ char *found; // cout << "ngramcache::get() "; |