Saving to disk is super slow

Hi

I’m working with Aspose Slides for C++ 20.10.

It takes forever to save presentations to disk. It’s just a 2MB PPTX file, and it takes 8 seconds to save on a 32GB I9 MacbookPro.

I’m doing it like this:

SharedPtr stream = MakeObject(outfile, FileMode::Create);
_pres->Save(stream, format);

I also tried to save directly to file (without stream), but it’s not faster at all.

What am I doing wrong? This is supposed to be fast, right? How long should it take to save a 2MB file.
What’s the best way to write the file to disk?

EDIT:

I’m working on a PHP extension so I’m calling this from PHP. However, just for testing purposes, I tried to create a native executable as well, which saves a minimal presentation like this:

#include “./include/aspose.h”

using namespace Aspose::Slides;
using namespace System;
using namespace Export;

int main() {
const System::String outPath = u"./out.pptx";

SharedPtr pres = MakeObject< Presentation>();

pres->Save(outPath, SaveFormat::Pptx);
return 0;
}

This is just as slow as the PHP call, and it’s a native executable compiled under Ubuntu Linux.

What’s wrong?

Thanks in advance.

@gtamas,
Thank you for the issue description. Could you share a presentation sample that can be used for investigating the problem, please?

Hi

@Andrey_Potapov

What do you mean by “presentation sample”?
Can you try to compile the minimal code segment above? I’m using g++ as compiler and linker and compiled it like this:

Compile:

g++ -Wall -I/path/to/aspose-slides-cpp-linux-20.10/include/aspose.slides.cpp -I/path/to/aspose-slides-cpp-linux-20.10/include/asposecpplib -c -O2 -std=c++2a -fpic -o test.o test.cpp

Link:

g++ -fuse-ld=gold -o testprg test.o -lAspose.Slides_clang3_libstdcpp -laspose_cpp_clang3_libstdcpp -L/path/to/aspose-slides-cpp-linux-20.10/lib

After this, executing testprg takes 7-8 secs and it’s an empty presentation, the resulting file is only 28K.

@gtamas,
I have logged the issue in our tracking system with ID SLIDESCPP-2822 for further investigation.

I meant the presentation file that you mentioned here:

Hi

Thanks for looking into this.
I attached the presentation file I mentioned earlier.

However, I don’t think it’s the file, because saving an empty presentation takes almost as long.

file.pptx.zip (2.1 MB)

@gtamas,
Thank you for the presentation sample. We have to verify it too.

@Andrey_Potapov
Any updates on this? This slowness is actually a problem for us. Any suggestions on how to speed this up would be appreciated.

Thanks in advance!

@gtamas,
I requested an estimated time to solve this issue from our development team. I will inform you as soon as I know.

@gtamas,
A fix is planned for Aspose.Slides 21.4.

@gtamas,
Our development team investigated the issue. The slowdown occurred due to the fact that some fonts are missing on your machine. An empty presentation requires the Arial font family to be available in your environment. Your presentation uses the Century Gothic font that is also missing from Linux by default. So you should install all fonts that are used in the presentation. The simplest way to install Arial fonts is sudo apt install ttf-mscorefonts-installer on Ubuntu.

Also, you can try to use font replacement if you cannot install the fonts. For example:

SharedPtr<FontData> sourceFont = MakeObject<FontData>(u"Arial");
SharedPtr<FontData> destFont = MakeObject<FontData>(u"Times New Roman");
	
pres->get_FontsManager()->ReplaceFont(sourceFont, destFont);

More details: Font Replacement

Thank you for the info!

The issues you have found earlier (filed as SLIDESCPP-2822) have been fixed in this update.