AddTextLayer takes too much time when adding several layers

Hi! So, I tested the following code:

int X = 100;

using (var psd = new PsdImage(300, 100))
{

    for (var i = 0; i < X; i++)
    {
        var watch = Stopwatch.StartNew();
        psd.AddTextLayer($"text {i}", new Rectangle(0, 0, 10, 10));
        watch.Stop();

        Console.WriteLine(watch.ElapsedMilliseconds);
    }

    var saveWatch = Stopwatch.StartNew();
    psd.Save("myLoopingTest.psd", new PsdOptions());
    saveWatch.Stop();

    Console.WriteLine($"save: {saveWatch.ElapsedMilliseconds}");
}

and noticed it takes longer for each iteration to execute AddTextLayer, starting arround 700ms and ending about 3s (per AddTextLayer invocation).
I ran some tests… executed the same code for 20, 40, 60, 80 & 100:
image.png (53.1 KB)
Almost the exact same times, each iteration takes longer to execute than the one before.

I also found out, when invoking the Save method takes a lot of time too, for bigger numbers, it takes more that what it took to add every layer.
image.png (16.0 KB)

So, my question is: is there any way to improve these times?
My typical PSD (mostly text, with some images and figures) is taking 6 minutes each, almost all of it because of the TextLayers.
Thanks.

@gonzalo.gatti.ethofy
Interesting findings. Every text layer has his section in global text layer resource, so with the each adding this section become bigger, also the blending is needed for each layer. Aspose.PSD team can try to process rendering only on final save.

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): PSDNET-2264

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.