3
votes
Vote UpVote

What’s wrong with virtual methods called through an interface

Andy's Blog – Calling a virtual method through an interface always was a lot slower than calling a static method through an interface. But why is that? Sure, the virtual method call costs some time, but comparing it with the difference of a normal static and virtual method call shows that the timings diverge too much. i7-4790 3.6GHz10,000,000 calls to empty method Instance call Interface call Static method 12 ms 17 ms Virtual method 17 ms 164 ms Let’s assume we have this declaration: type  IMyInterface = interface    procedure Test(A, B: Integer);  end;  TTest = ...
Favorite? Off-Topic? Andreas Hausladen @ 2016-05-31 20:20

Statistics

Visits: 1554
Votes: 3
Favorites: 0
Off-Topic: 0

Visits by Source

User Actions

Users who voted for this posting

Alister Christie
Ph. B.
Wouter
Subscribe:
Contact us to advertise on DelphiFeeds.com

Community Links

Torry Firebird News

Sponsor

 
Please login or register to use this functionality.
(click on this box to dismiss)