Hello all, it's been quite a while.
At my workplace we have been using CorelDRAW 2018 with several complex custom-built VBA macros made by me. This involves nesting, object manipulation, large scale duplication and several other things that tend to take quite while.
I remember seeing somewhere on the website that the performance in 2020 has been drastically improved and decided to put it to a test. Just making a simple macro where 10000 objects are created and then rotated.
Pure creation was about 5 times faster and creation, then rotation about 2 times faster. Of course, I used this excellent optimization advice from GDG_John.
Now my question is - does the 2020 version have any other optimization tools for VBA macros?
Thanks, I will try to implement some of this for sure, but in general my example was just something very simple and not quite what I'm doing with the real macro.
There I am working with existing shapes, giving them contours, separating them, moving things around, etc.
But still - do you have 2020 and an older version in hand to give the difference a try? Simple shape movement being much slower in 2020 seems really weird. Certainly surprised me after the promise of solid performance improvements.
I tryed the code in X7 and in 2020. 2020 is slower. I'm too lazy to check which operation is slower than in X7, so I trust you that it is the "move".
Thanks, would be neat to hear from someone from Corel what is up with that...
Joe said:Thanks, would be neat to hear from someone from Corel what is up with that...
I think it would be great if those interested in automation had some - even a little bit of - access to Corel developers.
I'm aware of a number of things that are outright broken, and simply don't work correctly when using the API. With essentially no access to the Corel developers, I have zero hope that those problems will ever be corrected.
Well, I am enjoying the current solo activity in this forum...
Anyway, I have been testing that original optimization sub, changing the order and such. In the end the original way is the best. Although, really, the change is maybe half a percent or such.
Then I decided to test a thing I have known to be annoying and slow for a long time - the undo feature:
Sub Undo() Dim T As Single T = Timer ActiveDocument.Undo MsgBox Timer - T End Sub Sub GoodUndo() Dim T As Single T = Timer Optimization = True EventsEnabled = False ActiveDocument.Undo Optimization = False EventsEnabled = True ActiveWindow.Refresh MsgBox Timer - T End Sub
The regular Undo command blinks the cursor between the regular arrow and the wait icon all the time. And takes FOUR TIMES as long as the optimized Undo.
Sounds like I may have to change the shortcut for this improved version. Will have to test it for stability, though.
Also during testing I have run into something that just makes everything in CorelDRAW literally 6 times slower and stays that way in all documents. Couldn't figure what it was so far, but will have to try and catch it.