Search The ForumSearch   RegisterRegister  LoginLogin

MailBee.NET Objects

 AfterLogic Forum : MailBee.NET Objects
Subject Topic: Slow message extraction Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
softwareguy
Newbie
Newbie


Joined: 17 July 2010
Location: United States
Online Status: Offline
Posts: 22
Posted: 24 July 2010 at 9:52pm | IP Logged Quote softwareguy

Maybe I'm doing something wrong in the code, but for a PST with only 125 emails, this code takes 35 seconds to complete, where a competing product (which interestingly is slower in all other ways) is WAY faster at only 2.2 seconds:

Dim index As Integer = 0
Dim folders As PstFolderCollection = MailBeeReader.GetPstRootFolders(True)
For Each folder As PstFolder In folders
   If folder.ShortName = lstFolders.SelectedItem Then
      For Each item As PstMessage In folder.Items
        If item.PstType = PstItemType.Message Then
               Dim msg As MailMessage = item.GetAsMailMessage
               Dim conv As New MsgConvert
               conv.MailMessageToMsg(msg, "C:\Users\jdoe\Documents\msg\" + index.ToString + ".msg")
        End If
        index += 1
      Next
      Exit For
   End If
Next

Is there any way to improve the speed of the above code? 30 seconds for only 125 emails is way too slow. There must be something I'm doing wrong here.
Back to Top View softwareguy's Profile Search for other posts by softwareguy
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 25 July 2010 at 2:56am | IP Logged Quote Alex

Profile it! You can easily find out which section of the code takes most time by adding timestamps throughout the code and then examining your console or file output (where you saved the timestamps) where the bottleneck is. Maybe, it's slow only for certain particular messages (or a particular statement is slow).

Also, with profiling you'll be able to find out which statements execute more times than it should, etc (if you also insert the method name to be executed in your timestamp). I don't say there ARE such statements in your code but who knows.

BTW, there is no need to create MsgConvert for each message, you may create it before the loop. This will save some resources, although I don't think this is the bottleneck.

Regards,
Alex
Back to Top View Alex's Profile Search for other posts by Alex
 
softwareguy
Newbie
Newbie


Joined: 17 July 2010
Location: United States
Online Status: Offline
Posts: 22
Posted: 25 July 2010 at 7:18am | IP Logged Quote softwareguy

I will work on putting timers in there today and reply back with the results. I might add that these 125 emails are very small, with one exception of being about 3MB. But again, the other product can do it in 2.2sec flat. So it will be interesting to see where MailBee is taking so much time on this and maybe we can improve that.
Back to Top View softwareguy's Profile Search for other posts by softwareguy
 
softwareguy
Newbie
Newbie


Joined: 17 July 2010
Location: United States
Online Status: Offline
Posts: 22
Posted: 25 July 2010 at 7:49pm | IP Logged Quote softwareguy

It seems that the delay is occurring at the conversion line:

conv.MailMessageToMsg(msg, "C:\Users\jdoe\Documents\msg\" + index.ToString + ".msg")

You can see by the log below, that the GetAsMailMessage is insignificant, but the MailMessageToMsg where the file is saved is taking all the time. By contrast, the competitors "save" method (which doesn't require a conversion by the way), takes a total of 0 to 2ms for most of the emails, with exception for the few larger ones which is about 200ms total.

Maybe some work can be done to increase performance on the MailConvert object?

GetPstRootFolders: 9
GetAsMailMessage: 5
MailMessageToMsg (size: 7179): 202
GetAsMailMessage: 1
MailMessageToMsg (size: 4750): 151
GetAsMailMessage: 2
MailMessageToMsg (size: 3706): 160
GetAsMailMessage: 2
MailMessageToMsg (size: 7778): 155
GetAsMailMessage: 2
MailMessageToMsg (size: 5492): 200
GetAsMailMessage: 2
MailMessageToMsg (size: 10209): 163
GetAsMailMessage: 2
MailMessageToMsg (size: 10846): 197
GetAsMailMessage: 3
MailMessageToMsg (size: 8387): 246
GetAsMailMessage: 1
MailMessageToMsg (size: 4478): 90
GetAsMailMessage: 2
MailMessageToMsg (size: 7906): 120
GetAsMailMessage: 2
MailMessageToMsg (size: 7674): 160
GetAsMailMessage: 81
MailMessageToMsg (size: 5410437): 575
GetAsMailMessage: 2
MailMessageToMsg (size: 8344): 167
GetAsMailMessage: 2
MailMessageToMsg (size: 6289): 137
GetAsMailMessage: 2
MailMessageToMsg (size: 9433): 161
GetAsMailMessage: 2
MailMessageToMsg (size: 7571): 148
GetAsMailMessage: 2
MailMessageToMsg (size: 14711): 149
GetAsMailMessage: 2
MailMessageToMsg (size: 4900): 142
GetAsMailMessage: 3
MailMessageToMsg (size: 3706): 150
GetAsMailMessage: 2
MailMessageToMsg (size: 13430): 152
GetAsMailMessage: 2
MailMessageToMsg (size: 7982): 195
GetAsMailMessage: 1
MailMessageToMsg (size: 5772): 129
GetAsMailMessage: 2
MailMessageToMsg (size: 4954): 134
GetAsMailMessage: 2
MailMessageToMsg (size: 6419): 95
GetAsMailMessage: 2
MailMessageToMsg (size: 5607): 138
GetAsMailMessage: 2
MailMessageToMsg (size: 9988): 225
GetAsMailMessage: 6
MailMessageToMsg (size: 42218): 226
GetAsMailMessage: 2
MailMessageToMsg (size: 7520): 182
GetAsMailMessage: 2
MailMessageToMsg (size: 7450): 138
GetAsMailMessage: 2
MailMessageToMsg (size: 5246): 194
GetAsMailMessage: 2
MailMessageToMsg (size: 5014): 192
GetAsMailMessage: 15
MailMessageToMsg (size: 754776): 232
GetAsMailMessage: 2
MailMessageToMsg (size: 6001): 130
GetAsMailMessage: 3
MailMessageToMsg (size: 28250): 185
GetAsMailMessage: 2
MailMessageToMsg (size: 9865): 136
GetAsMailMessage: 2
MailMessageToMsg (size: 8601): 148
GetAsMailMessage: 2
MailMessageToMsg (size: 5309): 171
GetAsMailMessage: 2
MailMessageToMsg (size: 6676): 183
GetAsMailMessage: 2
MailMessageToMsg (size: 9157): 149
GetAsMailMessage: 3
MailMessageToMsg (size: 24997): 120
GetAsMailMessage: 2
MailMessageToMsg (size: 13524): 83
GetAsMailMessage: 3
MailMessageToMsg (size: 25124): 1113
GetAsMailMessage: 2
MailMessageToMsg (size: 12159): 150
GetAsMailMessage: 2
MailMessageToMsg (size: 10710): 137
GetAsMailMessage: 2
MailMessageToMsg (size: 5296): 171
GetAsMailMessage: 2
MailMessageToMsg (size: 5257): 213
GetAsMailMessage: 2
MailMessageToMsg (size: 9664): 135
GetAsMailMessage: 2
MailMessageToMsg (size: 7497): 136
GetAsMailMessage: 2
MailMessageToMsg (size: 9114): 136
GetAsMailMessage: 2
MailMessageToMsg (size: 6793): 131
GetAsMailMessage: 2
MailMessageToMsg (size: 15147): 188
GetAsMailMessage: 2
MailMessageToMsg (size: 8678): 138
GetAsMailMessage: 1
MailMessageToMsg (size: 7533): 139
GetAsMailMessage: 2
MailMessageToMsg (size: 9716): 155
GetAsMailMessage: 4
MailMessageToMsg (size: 121978): 224
GetAsMailMessage: 1
MailMessageToMsg (size: 6681): 128
GetAsMailMessage: 2
MailMessageToMsg (size: 14086): 137
GetAsMailMessage: 2
MailMessageToMsg (size: 14052): 146
GetAsMailMessage: 5
MailMessageToMsg (size: 35865): 235
GetAsMailMessage: 3
MailMessageToMsg (size: 48294): 4544
GetAsMailMessage: 6
MailMessageToMsg (size: 6253): 181
GetAsMailMessage: 2
MailMessageToMsg (size: 5111): 188
GetAsMailMessage: 2
MailMessageToMsg (size: 5174): 1768
GetAsMailMessage: 5
MailMessageToMsg (size: 7639): 5702
GetAsMailMessage: 5
MailMessageToMsg (size: 10033): 2933
GetAsMailMessage: 3
MailMessageToMsg (size: 51105): 149
GetAsMailMessage: 2
MailMessageToMsg (size: 3658): 146
GetAsMailMessage: 2
MailMessageToMsg (size: 11225): 152
GetAsMailMessage: 2
MailMessageToMsg (size: 7897): 133
GetAsMailMessage: 3
MailMessageToMsg (size: 9695): 137
GetAsMailMessage: 1
MailMessageToMsg (size: 6382): 106
GetAsMailMessage: 2
MailMessageToMsg (size: 8693): 135
GetAsMailMessage: 2
MailMessageToMsg (size: 9878): 179
GetAsMailMessage: 2
MailMessageToMsg (size: 9770): 134
GetAsMailMessage: 2
MailMessageToMsg (size: 7779): 131
GetAsMailMessage: 2
MailMessageToMsg (size: 50190): 150
GetAsMailMessage: 2
MailMessageToMsg (size: 6913): 213
GetAsMailMessage: 1
MailMessageToMsg (size: 5040): 138
GetAsMailMessage: 2
MailMessageToMsg (size: 5692): 1669
GetAsMailMessage: 4
MailMessageToMsg (size: 6604): 179
GetAsMailMessage: 2
MailMessageToMsg (size: 9598): 144
GetAsMailMessage: 2
MailMessageToMsg (size: 11583): 144
GetAsMailMessage: 2
MailMessageToMsg (size: 8596): 143
GetAsMailMessage: 1
MailMessageToMsg (size: 4304): 528
GetAsMailMessage: 3
MailMessageToMsg (size: 8278): 193
GetAsMailMessage: 1
MailMessageToMsg (size: 6610): 1366
GetAsMailMessage: 8
MailMessageToMsg (size: 26441): 169
GetAsMailMessage: 2
MailMessageToMsg (size: 8245): 147
GetAsMailMessage: 2
MailMessageToMsg (size: 9673): 149
GetAsMailMessage: 5
MailMessageToMsg (size: 13587): 145
GetAsMailMessage: 2
MailMessageToMsg (size: 13529): 155
GetAsMailMessage: 2
MailMessageToMsg (size: 8297): 147
GetAsMailMessage: 2
MailMessageToMsg (size: 10372): 110
GetAsMailMessage: 2
MailMessageToMsg (size: 7766): 142
GetAsMailMessage: 1
MailMessageToMsg (size: 5661): 147
GetAsMailMessage: 2
MailMessageToMsg (size: 8168): 156
GetAsMailMessage: 1
MailMessageToMsg (size: 7585): 144
GetAsMailMessage: 2
MailMessageToMsg (size: 8641): 144
GetAsMailMessage: 2
MailMessageToMsg (size: 5482): 135
GetAsMailMessage: 2
MailMessageToMsg (size: 3707): 107
GetAsMailMessage: 2
MailMessageToMsg (size: 10433): 142
GetAsMailMessage: 1
MailMessageToMsg (size: 4781): 121
GetAsMailMessage: 1
MailMessageToMsg (size: 4823): 142
GetAsMailMessage: 2
MailMessageToMsg (size: 6465): 147
GetAsMailMessage: 2
MailMessageToMsg (size: 4386): 135
GetAsMailMessage: 1
MailMessageToMsg (size: 5296): 128
GetAsMailMessage: 1
MailMessageToMsg (size: 6187): 108
GetAsMailMessage: 1
MailMessageToMsg (size: 6066): 127
GetAsMailMessage: 7
MailMessageToMsg (size: 13677): 141
GetAsMailMessage: 2
MailMessageToMsg (size: 7602): 138
GetAsMailMessage: 3
MailMessageToMsg (size: 6915): 190
GetAsMailMessage: 2
MailMessageToMsg (size: 3306): 137
GetAsMailMessage: 2
MailMessageToMsg (size: 6360): 171
GetAsMailMessage: 2
MailMessageToMsg (size: 6339): 110
GetAsMailMessage: 2
MailMessageToMsg (size: 8018): 132
GetAsMailMessage: 3
MailMessageToMsg (size: 7437): 175
GetAsMailMessage: 2
MailMessageToMsg (size: 5803): 1303
GetAsMailMessage: 3
MailMessageToMsg (size: 16509): 140
GetAsMailMessage: 3
MailMessageToMsg (size: 9721): 137
GetAsMailMessage: 2
MailMessageToMsg (size: 3695): 135
GetAsMailMessage: 2
MailMessageToMsg (size: 9821): 142
GetAsMailMessage: 4
MailMessageToMsg (size: 86089): 795
GetAsMailMessage: 2
MailMessageToMsg (size: 7174): 180
GetAsMailMessage: 2
MailMessageToMsg (size: 9624): 123
GetAsMailMessage: 1
MailMessageToMsg (size: 8703): 141
GetAsMailMessage (total): 378
MailMessageToMsg (total): 39744
Back to Top View softwareguy's Profile Search for other posts by softwareguy
 
Igor
AfterLogic Support
AfterLogic Support


Joined: 24 June 2008
Location: United States
Online Status: Offline
Posts: 6104
Posted: 26 July 2010 at 6:15am | IP Logged Quote Igor

To let us check that, please send us the PST file using our HelpDesk interface. Thank you.

--
Regards,
Igor, AfterLogic Support
Back to Top View Igor's Profile Search for other posts by Igor
 
softwareguy
Newbie
Newbie


Joined: 17 July 2010
Location: United States
Online Status: Offline
Posts: 22
Posted: 26 July 2010 at 7:13am | IP Logged Quote softwareguy

I will try to do that later this evening sometime.

I'm just curious though. Why is it that I must take the extra step of converting a message extracted from a PST to an Outlook MapiMessage? When would an email out of a PST ever NOT be a Outlook message type? The competitor product treats all messages in the PST as an Outlook message type immediately so there is no conversion step.
Back to Top View softwareguy's Profile Search for other posts by softwareguy
 
Igor
AfterLogic Support
AfterLogic Support


Joined: 24 June 2008
Location: United States
Online Status: Offline
Posts: 6104
Posted: 26 July 2010 at 7:28am | IP Logged Quote Igor

Well, it's never MSG there in PST. According to the developer in charge, some third format is used.

The primary point of PstReader is to get inside of complex binary format and to pull out a message in simple and well-known MIME format. And since PstReader actually gets MailMessage object which can be saved to EML or MSG in one step, this doesn't look like major overkill.

--
Regards,
Igor, AfterLogic Support
Back to Top View Igor's Profile Search for other posts by Igor
 
softwareguy
Newbie
Newbie


Joined: 17 July 2010
Location: United States
Online Status: Offline
Posts: 22
Posted: 26 July 2010 at 7:56am | IP Logged Quote softwareguy

But as you can see by the log, there does seem to be significant overhead of converting to MSG format, even for small emails. But as you requested, I will send a sample PST later this evening.
Back to Top View softwareguy's Profile Search for other posts by softwareguy
 
Audra
Newbie
Newbie
Avatar

Joined: 13 April 2011
Online Status: Offline
Posts: 1
Posted: 13 April 2011 at 1:25am | IP Logged Quote Audra

Alex wrote:
Profile it! You can easily find out which section of the code
takes most time by adding timestamps throughout the code and then examining your
console or file output (where you saved the timestamps) where the bottleneck is.
Maybe, it's slow only for certain particular messages (or a particular statement
is slow).

Also, with profiling you'll be able to find out which statements execute more
times than it should, etc (if you also insert the method name to be executed in
your timestamp). I don't say there ARE such statements in your code but who
knows.

BTW, there is no need to create MsgConvert for each message, you may create it
before the loop. This will save some resources, although I don't think this is
the bottleneck.

Regards,
Alex


I might add that these 125 emails are very small, with one exception of being
about 3MB. But again, the other product can do it in 2.2sec flat.
Back to Top View Audra's Profile Search for other posts by Audra
 
Igor
AfterLogic Support
AfterLogic Support


Joined: 24 June 2008
Location: United States
Online Status: Offline
Posts: 6104
Posted: 13 April 2011 at 6:17am | IP Logged Quote Igor

Quote:
I might add that these 125 emails are very small, with one exception of being about 3MB. But again, the
other product can do it in 2.2sec flat.


Could you please explain how exactly this is connected to initial request? I mean, the initial message was
submitted over 8 months ago, and the latest one is sent by another user.

If you're the same person who started the thread - did you try using the latest build of MailBee.NET.dll?
During that time, many modifications were added to the product, so it might operate faster than before.

--
Regards,
Igor, AfterLogic Support
Back to Top View Igor's Profile Search for other posts by Igor
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump

Powered by Web Wiz Forums version 7.9
Copyright ©2001-2004 Web Wiz Guide