[fpc-pascal] FPImage and GetDataLineStart

Michael Van Canneyt michael at freepascal.org
Thu Apr 21 21:45:29 CEST 2011



On Thu, 21 Apr 2011, Marco van de Voort wrote:

> In our previous episode, Michael Van Canneyt said:
>>> If you declare your class as e.g. TBW32image (RGBA), a pixel assignment is
>>> an inline handful of instructions.
>>>
>>> I think fcl-image with its no-compromise format support was great initial
>>> effort.  But it is time to at least allow some internal shortcuts for
>>> performance's sake. And generics allow a way to put this into a class
>>> hierarchy without too much code duplication.
>>
>> You can propose whatever you want _but_ generics.
>
> Motivation?

Threefold:
a) The compiler's handling of generics is still beta code in my opinion.
    As far as I know, the original problem I reported when writing the docs
    for them is still not solved.

b) It's demonstratibly slower than optimized classes.
    (see the whole debate on core when it was started.
     The problem is not an optimizer one, but the need to revert
     to slower but more general programming techniques when using generics)
    Since the idea is to make things faster, generics are a poor choice.

c) I want my own code to be 100% generics-free, and I happen to use fp-image a lot.

But if you want to write generics-based image handling classes, feel free 
to put them in fcl-stl, just not in fp-image. I'll be glad to make some 
reasonable changes to the base classes to make this possible.

Michael.



More information about the fpc-pascal mailing list