On Sat, Jan 30, 2016 at 2:19 PM, silvioprog <silviop...@gmail.com> wrote:

> On Fri, Jan 29, 2016 at 8:28 AM, Marco van de Voort <mar...@stack.nl>
> wrote:
>
>> In our previous episode, silvioprog said:
>> > > The format of interface VMTs could also differ per platform so
>> considering
>> > > that as more stable only holds true because of what we currently
>> support.
>> > >
>> >  Sorry for ask here, but, don't you recomment to use interfaces? I'm
>> making
>> > a project and I'm planning to use some COM interfaces to make something
>> a list
>> > adapter
>> > <http://developer.android.com/reference/android/widget/ListAdapter.html
>> >.
>>
>> Interfaces are relatively slow. Not only because of the refcounting, but
>> returning interfaces in a tight loop (e.g. to get the elements of an
>> enumeration) would be a new allocation each time.
>
>
> Hm... I didn't know that.
>
> I need to take a test using some profiling tool to check the real cost
> using interfaces, because in my case I'm using lists. However, I still
> can't understand why some programmers avoid to use interfaces in Pascal.
> :-/
>

Well, I did a simple test. Result:

C: 00:00:11.008
I: 00:00:14.555
I: 00:00:14.511
C: 00:00:10.880
Press [ENTER] to exit ...

Source: http://pastebin.com/x74V4gEx .

It seems that the COM interfaces is a little bit slower than classes.
Anyway, I don't have problem to use interfaces, however I'll use it only
when it is really necessary.

-- 
Silvio Clécio
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to