Faster Macro Execution

Usage tips, posted by users. No questions here please.

Moderators: AmigoJack, helios, bbadmin, Bob Hansen, MudGuard

Post Reply
User avatar
Fredkc
Posts: 6
Joined: Tue Apr 10, 2007 11:26 pm
Location: Riverside, Ca.
Contact:

Faster Macro Execution

Post by Fredkc »

Ok, I've been using TextPad for roughly ten years, but today is the first day I have participated in this form. I searched the Tips section on either/or/and "speed" and "screen" and came up blank before posting this. Maybe I'm posting the obvious, I don't know. But...

Faster Macro Execution:
If you process long files for CSV or any other reason, this is highly worth your time to use.

When you are executing a macro over a large file, you can speed up the process by a factor of 10, at least.

Heres how:
1.
Open any other window, a browser perhaps, and size it's window so it completely covers both the text window, and the Document Selector window (if open) of TextPad, plus enough so you can bring it forward by clicking on it after you start the macro.

2. Then bring TextPad forward, and start your macro.

3. Click on the "other window" with the mouse, and keep the mouse off of any still-visible portion of TextPad while the macro runs. If I am not explaining this clear enough, please see this example here.

If you want to see the difference in speed, place the other window so that only the scroll indicator of the text window can be seen (see picture), to indicate progress.

Updating the screen at each line shift in text takes a huge amount of your computer's CPU time. Cover the window and Windows no longer does this, freeing up CPU time for the real work of making the changes.

Re. Mouse:
While a macro is executing, TextPad shows you an hourglass mouse pointer. Whether it's Textpad's, or Micro$not's programming I don't know, but a decision is made at the end of each macro execution, to determine whether or not to keep the hourglass, or switch back to the normal pointer. Keep your mouse off the TextPad window, as this also eats up CPU time, and slows macro execution.

Re Document Selector Box:
I sometimes will write macros that process a line, then copy/paste it to another window as I go. The current file is highlighted in the "Doc. Sel. Box" each time you switch files. Updating this box also eats CPU time, and slows down multi-window macros.

Hope this helps.
Fred
Life IS mystical. It's just that we're used to it.
User avatar
morteda
Posts: 7
Joined: Mon Apr 23, 2007 3:51 pm
Location: Minneapolis

Post by morteda »

I had wondered about something like this but never thought of using a semi-background and comparing execution duration. Thanks for posting this will give it a whirl.
Les meilleurs souvenirs sont ceux que l'on a oubliés // The best memories are those we have forgotten // _Alfred Capus
nvj1662
Posts: 56
Joined: Thu May 17, 2007 10:02 am

Post by nvj1662 »

I wonder wether simply minimising the textpad window would have the same effect.
Arathorn76
Posts: 1
Joined: Tue Mar 06, 2007 2:32 pm

Post by Arathorn76 »

nvj1662 wrote:I wonder wether simply minimising the textpad window would have the same effect.
Yes, it does.
I often compute files of 10 000 to 20 000 000 lines with complex macros.
Minimising the textpad window (I´m using 4.7.2) saves CPU time and reduces memory usage.
In addition I usualy force textpad to use one of my CPUs only, thus making it possible to actually use my PC for other tasks (decent machine, but visible textpad operation slows it down to abakus speed...).
To check whether my macro finished I just watch the Task Manager.
User avatar
Fredkc
Posts: 6
Joined: Tue Apr 10, 2007 11:26 pm
Location: Riverside, Ca.
Contact:

Post by Fredkc »

Yes, it does.
I often compute files of 10 000 to 20 000 000 lines with complex macros.
Thanks for adding that, Arathorn76. I often do the same when I am "flossing & glossing" a set of CSV entries for a Dbase.

The longest one I've done, so far, was 182,000 line entries. This was a complete copy of the 1913 Webster's Unabridged Dictionary, for which I worte a simple search engine.
http://fredsitelive.com/books/BigDic/index.php

If you enter coro* in the form, it will return all words (66 of them) starting with "coro" and anything (*) after that. Ex:
Corocore
Corody
Corol
Corolla
Corollaceous
Corollaries
Corollary
Corollary
Corollate
Corollated
Corollet
Corollifloral
Corolliflorous
Corolline
Coromandel

Another odd one I came up with will calculate the "as the crow flies" distance between any two US zip codes. This was a 42,000+ line Database. http://fredsitelive.com/reference/ziplat1.php

Ex: Using Riverside, Ca, 92509 and Boulder, Co. 90310, The distance between cities: 788.6 miles. Or: 1,269.1 Kilometers.

I had never been adventurous enough to try minimizing the window, because in my experience some clicks on the TextPad window will stop the macro. If the window is minimized, it's hard to tell if that's happened. will give it a shot though, thanks,
Fred
Life IS mystical. It's just that we're used to it.
SELVOL
Posts: 15
Joined: Wed Oct 21, 2009 11:16 am

Never too late for tips.

Post by SELVOL »

Yes, Minimizing text pad while it runs a macro or search and replace speeds it up 10x.


I was going to suggest this be added into the program. Where it minimized it self until done.

Be allot nicer to see the then TP frozen

Selvol
Post Reply