Optimize Runtime

Hi, I'am new to TMSScriter,..
I have a couple of questions..:
Creating scripts with the IDE is ok. I used the "save to Db" as in the "help files" decriped.,
To execute the sources is very slow...

Cause I stored the scripts in a database I used the example.
So when I load a project I use:
Every unit and form will be loaded. But it's extremely slow.
Seems that on the event loading any file like
AContent := udf.FieldByName('Content').AsString
seems a lot of parsing is done..

Cause I use databases I use IDEEngine and IDEScripter to load the project
Loading the units/forms takes a lot of time...
I didn't found any example to execute direct to scripter with db stored units.
There is no "LoadFile" Event..

Is there any advance storing the sources in compiled format?
How to do this?

I use IDEEngine and IDEScripter to load, just to execute a script.. seems that IDEEngine and IDEScripter produce (Maybe) a lot of work that's not neccesary..

Is there a faster way?

And BTW I was afraid that records and dynamic arrays are not supported. We used them a lot in Pascalscript from RemObjects.. but ok, we have to find a way..

thx for any input,

regars, ralf

It's very hard to tell what's going on without profiling. I just can't tell what is slow in your case. Could be anything - database access, too many files loaded, script parsing, etc.. Have you tried to profile your application to find what is the bottleneck?

In any case, you can save/load pseudo-compiled code.

When using standard Scripter component with a single script, you just need to call SaveCodeToFile and LoadCodeFromFile methods of scripter component to handle compiled code. When it comes to multi-script project using the Scripter Studio Pro engine, you must write extra code and save compiled code of all units (scripts). It's the same for loading: you must load compile code of all units. This is a pseudo-code example for saving compiled code:

for c := 0 to IDEEngine1.Files.Count - 1 do
  if not IDEEngine1.Files[i].Script.Compiled then

  AUnitName := IDEEngine1.Files[i].Script.ScriptInfo.UnitName;
  IDEEngine1.Files[o].Script.SaveCodeToFile(ABasePath + AUnitName + '.code');

To load the code, you just do the reverse. Pay attention to add directories to the search path where the compiled code is located, because scripter tries to load the compiled code for used units on the fly (if you load Unit1 and it uses Unit2, it tries to load Unit2 code by searching files in search path). Example:

with IDEScripter1 do
  {By setting the LibOptions properties below, you just need to load the script code for the main unit}
  LibOptions.UseScriptFiles := true;
  LibOptions.CompiledFileExt := '.code';

  {Load main unit only - the other units will be loaded on the fly based on the LibOptions settings}
  AddScript(slPascal).LoadCodeFromFile(ABasePath + MyMainUnitName + '.code');