Community
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Faster Macro Execution

 
Post new topic   Reply to topic    Community Forum Index -> Tips
View previous topic :: View next topic  
Author Message
Fredkc



Joined: 10 Apr 2007
Posts: 6
Location: Riverside, Ca.

PostPosted: Wed Apr 11, 2007 6:14 am    Post subject: Faster Macro Execution Reply with quote

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.
Back to top
View user's profile Send private message Visit poster's website
morteda



Joined: 23 Apr 2007
Posts: 7
Location: Minneapolis

PostPosted: Thu Apr 26, 2007 2:04 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
nvj1662



Joined: 17 May 2007
Posts: 56

PostPosted: Fri Jun 29, 2007 7:41 am    Post subject: Reply with quote

I wonder wether simply minimising the textpad window would have the same effect.
Back to top
View user's profile Send private message
Arathorn76



Joined: 06 Mar 2007
Posts: 1

PostPosted: Tue Sep 16, 2008 10:57 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
Fredkc



Joined: 10 Apr 2007
Posts: 6
Location: Riverside, Ca.

PostPosted: Tue Nov 18, 2008 3:14 am    Post subject: Reply with quote

Quote:
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.
Back to top
View user's profile Send private message Visit poster's website
SELVOL



Joined: 21 Oct 2009
Posts: 15

PostPosted: Mon Jul 09, 2012 3:33 am    Post subject: Never too late for tips. Reply with quote

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
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Community Forum Index -> Tips All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB