speed optimization

This commit is contained in:
Volker Fischer 2013-12-16 20:36:48 +00:00
parent 379a3e9f9d
commit cbaefb32da
2 changed files with 18 additions and 10 deletions

View file

@ -204,11 +204,13 @@ public:
else else
{ {
// data can be written in one step // data can be written in one step
const int iEnd = iPutPos + iInSize; std::copy ( vecData.begin(),
while ( iPutPos < iEnd ) vecData.begin() + iInSize,
{ vecMemory.begin() + iPutPos );
vecMemory[iPutPos++] = vecData[iCurPos++];
} // set the put position one block further (no wrap around needs
// to be considered here)
iPutPos += iInSize;
} }
} }
@ -269,11 +271,16 @@ public:
else else
{ {
// data can be read in one step // data can be read in one step
const int iEnd = iGetPos + iInSize; const std::vector<TData>::const_iterator ItMemoryGetPos =
while ( iGetPos < iEnd ) vecMemory.begin() + iGetPos;
{
vecData[iCurPos++] = vecMemory[iGetPos++]; std::copy ( ItMemoryGetPos,
} ItMemoryGetPos + iInSize,
vecData.begin() );
// set the get position one block further (no wrap around needs
// to be considered here)
iGetPos += iInSize;
} }
} }

View file

@ -37,6 +37,7 @@
#include <QUrl> #include <QUrl>
#include <QLocale> #include <QLocale>
#include <vector> #include <vector>
#include <algorithm>
#include "global.h" #include "global.h"
using namespace std; // because of the library: "vector" using namespace std; // because of the library: "vector"
#ifdef _WIN32 #ifdef _WIN32