A few more optimisation techniques I have used:

Use token functions to do string functions. For example, to get the extension of a file name use
Code:
$gettok(%fn,-1,$asc(.))


Try to search token lists or hash tables or custom listbox lines using wild matches like $wildtok or $fline or regex for more complex searches.

The key here is that the fewer script instructions you run to achieve your functionality the faster it runs. When you use token functions or wild-matches or regex or hash table searches to achieve your functionality you use fewer but more powerful instructions which run in compiled mIRC code rather than achieving it through many more mIRC script lines being interpreted, so it should be substantial faster.