mirror of
https://github.com/JakubMelka/PDF4QT.git
synced 2025-06-05 21:59:17 +02:00
Performance bugfixes
This commit is contained in:
@ -51,7 +51,6 @@ void PDFAbstractVisitor::acceptStream(const PDFStream* stream)
|
||||
PDFStatisticsCollector::PDFStatisticsCollector()
|
||||
{
|
||||
// We must avoid to allocate map item
|
||||
//std::vector<PDFObject::Type> types = PDFObject::getTypes();
|
||||
for (PDFObject::Type type : PDFObject::getTypes())
|
||||
{
|
||||
m_statistics.emplace(std::make_pair(type, Statistics()));
|
||||
@ -120,6 +119,13 @@ void PDFStatisticsCollector::visitStream(const PDFStream* stream)
|
||||
Statistics& statistics = m_statistics[PDFObject::Type::Stream];
|
||||
collectStatisticsOfDictionary(statistics, stream->getDictionary());
|
||||
|
||||
const QByteArray& byteArray = *stream->getContent();
|
||||
const uint64_t memoryConsumption = byteArray.size() * sizeof(char);
|
||||
const uint64_t memoryOverhead = (byteArray.capacity() - byteArray.size()) * sizeof(char);
|
||||
|
||||
statistics.memoryConsumptionEstimate += memoryConsumption;
|
||||
statistics.memoryOverheadEstimate += memoryOverhead;
|
||||
|
||||
acceptStream(stream);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user