Menu

#9 Optimisations and new function

open
nobody
None
5
2007-05-07
2007-05-07
Jools Wills
No

I added a new function "Parsetofile" which is useful
to pregenerate html from a script.

public sub ParseToFile(sFile)
Dim sParsed,oFSO,oFile
sParsed=GetOutput
sFile=Server.MapPath(sFile)
Set oFSO=Server.CreateObject("Scripting.FileSystemObject")
Set oFile=oFSO.CreateTextFile(sFile,True)
oFile.Write(sParsed)
oFile.Close
end sub

Also there are a few places where a simple Replace can be used instead of a regular expression one. Should be a bit faster then.

such as line 290

if p_variables_list.Exists(MatchName) then
p_regexp.Pattern = match.Value
p_template = p_regexp.Replace(p_template, p_variables_list.Item(MatchName))
end if

could be changed to

if p_variables_list.Exists(MatchName) then
p_template = Replace(p_template, match.Value, p_variables_list.Item(MatchName))
end if

there are other places too where a similar change can be made.

Discussion


Log in to post a comment.

MongoDB Logo MongoDB