We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Aspose performance issue when there are lots of addresses in the email

There are some method which are very slow when an email have thousands of TO addresses(2000) in it.

For example:
1. If I use MailAddressCollection.contain(MailAddress) to check before I add a new MailAddress to the MailAddressCollection, it will take 20seconds+ to add 5000 addresses.
Without the contain call, only need under 1 second to add 5000 addresses.

2. MapiMessage.getHeaders().clear() take 20 seconds to clean the collection. (the MapiMessage already have headers in it)
3. MapiMessage.getHeaders().add(customized headers) also took 20 seconds
4. MapiMessage.getHeaders().remove(“headerName”) also took 20 seconds.

Any of #2, #3 or #4 will take 20+ seconds. but if I use all of them, the total time is almost the same 20+ seconds. not sum of 60+ seconds.

Basically, when we created a MailMessage with thousands of addresses,
then convert it to MapiMessage using MapiMessage.fromMailMessage(message, MapiConversionOptions.getUnicodeFormat())

any updating on the MapiMessage.getHeaders() will take 20 seconds.

From profile, it’s the method com.aspose.email.internal.k.a.a which used 97%+ CPU.
Could you please check and try to improve it?

We had to manually update the MapiMessage to add extra headers.

Could you please look into this issue and give us an update?



Sample code which can reproduce the issue:

MailMessageLoadOptions mailLoadOption = new MailMessageLoadOptions();

StringBuilder sb = new StringBuilder();
sb.append(“Date: Sun, 9 Mar 2008 07:14:32 -0700\nSubject: test\nfrom:from@foo.com\nto:”);
for(int i=0; i<3000; i++) {
sb.append(“abcd” + i + "@foo.com, “);

MailMessage msg = MailMessage.load(new ByteArrayInputStream(sb.toString().getBytes()), mailLoadOption);

MapiMessage mapiMsg = MapiMessage.fromMailMessage(msg, MapiConversionOptions.getUnicodeFormat());

long startTime = System.currentTimeMillis();


System.out.println(System.currentTimeMillis() - startTime);

The result is: 10983 which is 11 seconds.

I found that aspose.email only have issue when all addresses are in ONE line. for example:
To: addr1, addr2, addr3…addr2000\n
It will take 11 seconds

longer line => slower. If I change address prefix abcd to abcdxxxxxxxxxxxxxxxxx, it took 20 seconds.

If I added 3000 lines, it only took 24ms.
To: addr1\n
To: addr2\n

To: addr3000\n

Hi Ying,

Thank you for sharing the detailed information with us.

We were able to reproduce the problems you mentioned when there are large number of recipients in the email message file. The issue has been logged as EMAILJAVA-33541 in our bug tracking system as performance problem for further investigation by our product team. We shall update you here once there is some information available about this ticket.

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

This message was posted using Notification2Forum from Downloads module by Aspose Notifier.