[fpc-devel] Re: dominant short strings in compiler source
Marco van de Voort
marcov at stack.nl
Sat May 20 22:39:02 CEST 2006
> On 20 May 06, at 11:43, L505 wrote:
> > > more useful than longstrings.
> >
> > Admitting that C-language style programming (*char) is more practical and real world than
> > Pascal programming?
>
> ;-) Well, that depends. I certainly don't think
> that *char is more practical for string
> manipulation in general. However, when talking
> about unit DOS, the underlying OS API calls
> usually expect null terminated strings anyway.
> Anybody could then decide whether he prefers the
> easy to use Pascal string, because he only starts
> executables with few parameters which could never
> cross the limit, or whether he needs PChar for
> whatever reason.
Of course, you will have "#0 not allowed" in the interface then. Most API's
tackle this by returning size also.
IMHO this whole discussion is nonsense. For basic path related stuff,
ansistring is good enough, and if findfirst/findnext are still limiting with
the current memmgr (afaik we changed to Micha's one since those original
tests).
Moreover, if the weak point of ansistrings is the heap copying and implicit
exceptions, the weak point of shortstrings iirc is unnecessary copying.
Something that might really start to hurt more if strings get longer.
So before deciding to introduce a new "long" shortstring based on ansistring
vs shortstring performance, a more thorough assesment should be done:
For the use of ansistrings for paths inside the compiler:
- does the new heapmgr improve ansistring peformance relatively?
- how much of the ansistring slowliness really depends on ansistring, and
not some system routine like findfirst/findnext.
For the use of ansistrings in other parts of the compiler (since maybe in time,
UTF8 could make 255 byte limitations for non ISO8859-1 languages more
pressing):
- Can turning implict excepctions off in core parts improve ansistring
performance?
- Find an expression for the difference in string copying in say a compiler
recompile for both ansistring and shortstring.
- What else can be done to improve ansistring performance ?
More information about the fpc-devel
mailing list