Page 1 of 1
Components or @ commands?
Posted: Fri Nov 16, 2012 1:17 pm
by Rado1
I started to optimize my projects, and in order to reduce the size of the project tree I rewrote many components to their @ variants in expressions. For example:
Code: Select all
// read level index file
@FileAction(File: LevelIndexFile, Action: 0);
if(FileExists) @SetAppState(State: TitleAppState);
The functionality is not so obvious from the project tree, but it is more "consistent" and there's the possibility to use local variables, ifs, fors, switches, etc.
My question is: what's the performance of @ script commands - better, worse, or the same as the original components?
Re: Components or @ commands?
Posted: Fri Nov 16, 2012 1:56 pm
by Kjell
Hi Rado1,
Rado1 wrote:I started to optimize my projects, and in order to reduce the size of the project tree I rewrote many components to their @ variants in expressions.
The filesize of your zgeproj won't differ much one way or another. It's purely a aesthetic preference if you prefer tree-based components or expression-based component-calls.
Rado1 wrote:My question is: what's the performance of @ script commands - better, worse, or the same as the original components?
It's identical. Besides, the component overhead will generally only account for a neglectable sliver of the entire performance footprint.
K
Posted: Fri Nov 16, 2012 2:36 pm
by Rado1
Good to know. I rewrote a lot of code and I do not want to revert it back due to performance issues. Thank you Kjell.
BTW this reminds me older feature request of adding line numbers and better syntax error reporting for expressions discussed in
this post.
Posted: Fri Nov 16, 2012 2:55 pm
by Kjell
Hmm,
Rado1 wrote:this reminds me older feature request of adding line numbers and better syntax error reporting for expressions
The SynEdit control shows line-numbers by default ( in Lazarus at least ), so no idea why this isn't there in the first place.
*Screenshot of Delphi SynEdit control ( with custom popup menu ).
K
Posted: Fri Nov 16, 2012 5:46 pm
by VilleK
Hi, download beta again for line numbers. It was just a flag that needed to be set.
Posted: Fri Nov 16, 2012 11:21 pm
by Rado1
VilleK wrote:download beta again for line numbers
Thank you Ville, I like line numbers. The only remaining thing is to extend expression syntax error messages to show line numbers. And maybe one additional improvement: allow to change font size in expression editor (e.g. by context menu or in Settings).
Posted: Mon Nov 19, 2012 8:33 am
by VilleK
I've now added line/column info to scripting parser errors so it will say "invalid primary (line:x, col:y)" and similar. Download the beta again. It won't affect all messages though because some error messages are from the code generation phase and by that time the line/col information is no longer available. Let me know if you get many errors without line numbers and I can try to find a way to improve it.
Posted: Mon Nov 19, 2012 9:24 am
by Rado1
I like the feature, thanks! Many invalid StatementExpr errors can be identified very easily.
The following errors do not show line numbers:
- Unsupported operator, line 2
- Invalid address expression, line 3