kick ass!
Printable View
kick ass!
Just did some benchmarks with reflection based stuff for kicks and giggles. I have to say I'm quite impressed. The script I ran was 1,000,000 calls to SmartGetFieldInt(0, 'jba.a');
Simba Code:MarkTime(T);
for I := 1 to 1000000 do
begin
LoginIndex := SmartGetFieldInt(0, 'jba.a');
end;
T := TimeFromMark(T);
Writeln('Total Time: '+ToStr(T));SCAR Code:T := Time.SysTime;
for I := 1 to 1000000 do
begin
LoginIndex := SmartGetFieldInt(0, 'jba.a');
end;
T := Time.SysTime - T;
Print('Total Time: '+Types.ToStr(T));
Results:
Simba Code:Starting Test.
Total Time: 9329
Successfully executed.SCAR Code:Starting test...
Total Time: 4836
Script finished (6848ms)
I've added implicit typecasting of TPoint to string now :p So aside from using ToStr you can also do this:
SCAR Code:uses
Types;
var
s: string;
begin
s := Point(5, 5);
PrintLn(s);
end.
Code:Succesfully compiled (15ms)
(5,5)
Script finished (0ms)
That just seems a bit unclear. I feel like a better option would he having it work like the `print` function in python:
python Code:print "hi", "i'm", "a spaced out string.", 3
So having the unlimited accepted parameters then allow one to specify the separator between them. Just a thought :)
None of the ambiguity of the implicit casting.
You can still use ToStr...
Parsing the syntax isn't much of a problem, integrating it into the engine is...
EDIT: Explicit typecasting of TPoint to string now also works:
SCAR Code:uses Types;
begin
PrintLn(string(Point(5, 5)));
end.
EDIT2: Now the asbtract, sealed, final and absolute keywords are also available check the release thread for examples.