Community Discussions and Support
Rule simpler code runs slower

No, both codes scan the whole folder content, no matter if they are unread, read, or both. While I use "Sort unread before read" option set ON on most of my folders, toggling it OFF didn't change the code behavior. I tested all scenarios I could think of including unread messages with some read in between.


It might be something related to the folder's index as longer code exits immediately if all of the folder's messages are marked read. If the shorter code is used, no matter if all, some or none messages are marked unread it will take much more time to complete.

<p>No, both codes scan the whole folder content, no matter if they are unread, read, or both. While I use "Sort unread before read" option set ON on most of my folders, toggling it OFF didn't change the code behavior. I tested all scenarios I could think of including unread messages with some read in between.</p><p> It might be something related to the folder's index as longer code exits immediately if all of the folder's messages are marked read. If the shorter code is used, no matter if all, some or none messages are marked unread it will take much more time to complete. </p>

-- Euler

Pegasus Mail 4.81.1154 Windows 7 Ultimate
IERenderer: 2.7.1.5 AttachMenu: 1.0.1.2
PMDebug: 2.5.8.34 BearHTML 4.9.9.6

Folks,

I have a set of General Rules I use attached to IMAP folders as well as to local ones (not the same code, obviously), mostly as on-open or on-close folder rules. I have found a short rule code can be a lot slower than a wordy one.

The code below...

[code]If not attribute 128 Move "d207b5d253199495908cc687524982e0"[/code]

 

Was changed by the following code with a great gain of performance.

[code]If attribute 128 Exit ""
Always MarkRead ""
Always Move "d207b5d253199495908cc687524982e0"[/code]

 

The syntactic sugar for "attribute 128" is "Is marked as having been read", and so, if the message is UNREAD (1st code) it should be moved to a given IMAP folder, otherwise ignored. The 2nd code — the wordy one — ignores READ messages, otherwise move it to the designed folder. I also added an additional command to mark the about-to-move message READ before moving, and yet so this code was substantially faster than the prior.

It seems to me that the both codes run over the whole set of folder's messages but the second does it more efficiently.  Any thoughts why?

<p>Folks,</p><p>I have a set of General Rules I use attached to IMAP folders as well as to local ones (not the same code, obviously), mostly as on-open or on-close folder rules. I have found a short rule code can be a lot slower than a wordy one.</p><p>The code below... </p><p>[code]If not attribute 128 Move "d207b5d253199495908cc687524982e0"[/code]</p><p> </p><p>Was changed by the following code with a great gain of performance. </p><p>[code]If attribute 128 Exit "" Always MarkRead "" Always Move "d207b5d253199495908cc687524982e0"[/code]</p><p> </p><p>The syntactic sugar for "attribute 128" is <i>"Is marked as having been read"</i>, and so, if the message is UNREAD (1st code) it should be moved to a given IMAP folder, otherwise ignored. The 2nd code — the wordy one — ignores READ messages, otherwise move it to the designed folder. I also added an additional command to mark the about-to-move message READ before moving, and yet so this code was substantially faster than the prior.</p><p>It seems to me that the both codes run over the whole set of folder's messages but the second does it more efficiently.  Any thoughts why? </p>

-- Euler

Pegasus Mail 4.81.1154 Windows 7 Ultimate
IERenderer: 2.7.1.5 AttachMenu: 1.0.1.2
PMDebug: 2.5.8.34 BearHTML 4.9.9.6

Hi

 

Off the top of my head I say  (other than you should have posted to list) that the long code Exits as soon as it gets to a read message, where the short code tests all messages

Ofcause it would help to see the whole rule

<p>Hi</p><p> </p><p>Off the top of my head I say  (other than you should have posted to list) that the long code Exits as soon as it gets to a read message, where the short code tests all messages</p><p>Ofcause it would help to see the whole rule </p>
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
With selected deselect posts show selected posts
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft