Sergei Gorelkin schrieb:

When dynamic strings are used all around, is the use of pointers to ShortString still recommended? (fmodule contains a lot of them)

Whenever you care about performance, you'll quickly realize that dynamic strings are plain inappropriate.

The concrete use of PShortString strings is inappropriate in your sense, because it results in allocation, copy and deallocation of temporary strings in the code, in many places. This behaviour gave birth to my question.


They provide fine-grained control over memory allocations, avoiding implicit try..finally blocks and memory allocations for temps. Copying still occurs, but with the highly optimized Move procedure it is pretty cheap. So please don't change such things just because something is "used all around".

All that would no more be needed after a decent redesign. Or the existing code is inappropriate, and all the mentioned operations can be removed from the source code, without affecting the behaviour and result.

DoDi

_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to