Free Support Forum - aspose.com

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.