Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 12/07/18 in all areas

  1. The ISafeGuard approach is not a smartpointer but creating a scope to some resource. There is a important difference: a smart pointer combines the resource and its lifetime management into one entity. Also the record based approach is the most naive one - while Spring4D offers this one as well it has a more advanced one. As for performance: measure it yourself: program MeasureIt; {$APPTYPE CONSOLE} uses Spring, Diagnostics, Classes, SysUtils, JclSysUtils; const ADD_COUNT = 10; CREATE_COUNT = 100000; procedure MeasureSpring; var s: IShared<TStringList>; i: Integer; begin s := Shared.Make(TStringList.Create); for i := 1 to ADD_COUNT do s.Add(i.ToString); end; procedure MeasureJcl; var s: TStringList; g: ISafeGuard; i: Integer; begin s := TStringList.Create; Guard(s, g); for i := 1 to ADD_COUNT do s.Add(i.ToString); end; procedure MeasureClassic; var s: TStringList; i: Integer; begin s := TStringList.Create; try for i := 1 to ADD_COUNT do s.Add(i.ToString); finally s.Free; end; end; procedure Main; var sw: TStopwatch; i: Integer; begin sw := TStopwatch.StartNew; for i := 1 to CREATE_COUNT do MeasureSpring; Writeln(sw.ElapsedMilliseconds); sw := TStopwatch.StartNew; for i := 1 to CREATE_COUNT do MeasureJcl; Writeln(sw.ElapsedMilliseconds); sw := TStopwatch.StartNew; for i := 1 to CREATE_COUNT do MeasureClassic; Writeln(sw.ElapsedMilliseconds); end; begin Main; Readln; end. The implementation in Spring 1.2.2 (currently released version) uses very optimized code for the smart pointer itself avoiding the overhead of an object allocation and all the code associated with it but only allocates a 12 Byte (32bit) block with the IMT. Since IShared<T> is not a regular interface but an anonymous method you can directly access the members of the underlying type. Yes, there is a method call every time but as you can measure that does not cause any significant overhead (unless you call .Add a million times). And even then the actual work being performed totally outweighs the smart pointer overhead
  2. I've just released the next version of OmniPascal. It's coming with support for the inherited keyword, type helpers and inline variables. http://blog.omnipascal.com/omnipascal-0-17-0-inherited-keyword-type-helpers-and-inline-variables/
  3. jbg

    IDE Fix pack for Rio

    Unless you use the external compiler, the compiler runs in the main thread and every time it updates the progress dialog it "pauses" the compilation. IDE Fix Pack reduces the slowdown a little bit by only updating the UI after a certain time interval or a filename change, thus not every "compiled lines" update repaints the UI. There are changes in the 64 bit compiler (e.g. some loop unrolling)
  4. Updated bundle size info for Delphi 10.3 Rio FireMonkey apps. http://www.fmxexpress.com/anatomy-of-a-delphi-10-3-rio-firemonkey-app-on-android-ios-windows-and-macos/
  5. Dalija Prasnikar

    10.3 Consumes 45% of my CPU

    Because, in its infinite wisdom, IDE decided you need to brush up your debugging skills 😎
×