1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

tried to reduce unnecessary map saving disk i/o a bit

This commit is contained in:
Perttu Ahola 2011-06-05 18:57:36 +03:00
parent a649d43fe7
commit 9b565b6bc4
5 changed files with 106 additions and 58 deletions

View file

@ -4987,9 +4987,7 @@ void ServerMap::save(bool only_changed)
u32 sector_meta_count = 0;
u32 block_count = 0;
{ //sectorlock
//JMutexAutoLock lock(m_sector_mutex); // Bulk comment-out
u32 block_count_all = 0; // Number of blocks in memory
core::map<v2s16, MapSector*>::Iterator i = m_sectors.getIterator();
for(; i.atEnd() == false; i++)
@ -5008,6 +5006,9 @@ void ServerMap::save(bool only_changed)
for(j=blocks.begin(); j!=blocks.end(); j++)
{
MapBlock *block = *j;
block_count_all++;
if(block->getChangedFlag() || only_changed == false)
{
saveBlock(block);
@ -5022,8 +5023,6 @@ void ServerMap::save(bool only_changed)
}
}
}//sectorlock
/*
Only print if something happened or saved whole map
*/
@ -5033,6 +5032,7 @@ void ServerMap::save(bool only_changed)
dstream<<DTIME<<"ServerMap: Written: "
<<sector_meta_count<<" sector metadata files, "
<<block_count<<" block files"
<<", "<<block_count_all<<" blocks in memory."
<<std::endl;
}
}