Make some debug prints verbose-only, remove others

This commit is contained in:
Rémi Verschelde 2018-08-24 09:35:07 +02:00
parent d442f3d0aa
commit 52466d57e9
139 changed files with 172 additions and 803 deletions

View file

@ -50,7 +50,6 @@ void PHashTranslation::generate(const Ref<Translation> &p_from) {
int size = Math::larger_prime(keys.size());
print_line("compressing keys: " + itos(keys.size()));
Vector<Vector<Pair<int, CharString> > > buckets;
Vector<Map<uint32_t, int> > table;
Vector<uint32_t> hfunc_table;
@ -107,7 +106,6 @@ void PHashTranslation::generate(const Ref<Translation> &p_from) {
}
int bucket_table_size = 0;
print_line("total compressed string size: " + itos(total_compression_size) + " (" + itos(total_string_size) + " uncompressed).");
for (int i = 0; i < size; i++) {
@ -117,8 +115,6 @@ void PHashTranslation::generate(const Ref<Translation> &p_from) {
if (b.size() == 0)
continue;
//print_line("bucket: "+itos(i)+" - elements: "+itos(b.size()));
int d = 1;
int item = 0;
@ -140,9 +136,6 @@ void PHashTranslation::generate(const Ref<Translation> &p_from) {
bucket_table_size += 2 + b.size() * 4;
}
print_line("bucket table size: " + itos(bucket_table_size * 4));
print_line("hash table size: " + itos(size * 4));
hash_table.resize(size);
bucket_table.resize(bucket_table_size);
@ -178,8 +171,6 @@ void PHashTranslation::generate(const Ref<Translation> &p_from) {
}
}
print_line("total collisions: " + itos(collisions));
strings.resize(total_compression_size);
PoolVector<uint8_t>::Write cw = strings.write();
@ -198,15 +189,11 @@ bool PHashTranslation::_set(const StringName &p_name, const Variant &p_value) {
String name = p_name.operator String();
if (name == "hash_table") {
hash_table = p_value;
//print_line("translation: loaded hash table of size: "+itos(hash_table.size()));
} else if (name == "bucket_table") {
bucket_table = p_value;
//print_line("translation: loaded bucket table of size: "+itos(bucket_table.size()));
} else if (name == "strings") {
strings = p_value;
//print_line("translation: loaded string table of size: "+itos(strings.size()));
} else if (name == "load_from") {
//print_line("generating");
generate(p_value);
} else
return false;
@ -248,11 +235,7 @@ StringName PHashTranslation::get_message(const StringName &p_src_text) const {
uint32_t p = htptr[h % htsize];
//print_line("String: "+p_src_text.operator String());
//print_line("Hash: "+itos(p));
if (p == 0xFFFFFFFF) {
//print_line("GETMSG: Nothing!");
return StringName(); //nothing
}
@ -271,9 +254,7 @@ StringName PHashTranslation::get_message(const StringName &p_src_text) const {
}
}
//print_line("bucket pos: "+itos(idx));
if (idx == -1) {
//print_line("GETMSG: Not in Bucket!");
return StringName();
}
@ -281,8 +262,6 @@ StringName PHashTranslation::get_message(const StringName &p_src_text) const {
String rstr;
rstr.parse_utf8(&sptr[bucket.elem[idx].str_offset], bucket.elem[idx].uncomp_size);
//print_line("Uncompressed, size: "+itos(bucket.elem[idx].comp_size));
//print_line("Return: "+rstr);
return rstr;
} else {
@ -292,8 +271,6 @@ StringName PHashTranslation::get_message(const StringName &p_src_text) const {
smaz_decompress(&sptr[bucket.elem[idx].str_offset], bucket.elem[idx].comp_size, uncomp.ptrw(), bucket.elem[idx].uncomp_size);
String rstr;
rstr.parse_utf8(uncomp.get_data());
//print_line("Compressed, size: "+itos(bucket.elem[idx].comp_size));
//print_line("Return: "+rstr);
return rstr;
}
}