www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Re: Wide characters support in D

reply Ruslan Nikolaev <nruslan_devel yahoo.com> writes:
--- On Tue, 6/8/10, Jesse Phillips <jessekphillips+D gmail.com> wrote:

 I think you really need to look more into what templates
 are and do.
 

Excuse me? Unless templates are something different in D (I can't be 100% sure since I am new D), it should be the case. At least in C++, that would be the case. As I said, for libraries you need to compile every commonly used instance, so that user will not be burdened with this overhead. http://www.digitalmars.com/d/2.0/template.html
 There is also going to be very little performance gain by
 using the 
 "system type" for strings. Considering that most of the
 work is not 
 likely going be to the system commands you mentioned, but
 within D itself.
 

It depends. For instance, if you work with files, write on the console output, use system functions, use Win32 api, DFL, there can be overhead.
Jun 07 2010
parent BCS <none anon.com> writes:
Hello Ruslan,

 --- On Tue, 6/8/10, Jesse Phillips <jessekphillips+D gmail.com> wrote:
 
 I think you really need to look more into what templates are and do.
 

every commonly used instance, so that user will not be burdened with this overhead.

You only need to do that where you are shipping closed source and for that, it should be trivial to get the compiler to generate all three versions.
 There is also going to be very little performance gain by
 using the
 "system type" for strings. Considering that most of the
 work is not
 likely going be to the system commands you mentioned, but
 within D itself.

It depends. For instance, if you work with files, write on the console output, use system functions, use Win32 api, DFL, there can be overhead.

Your, right: it depends. In the few cases I can think of where more of the D code will be interacting with non D code than just processing the text, you could almost use void[] as your type. Where would you care about the encoding but not do much worth it? Also unless you have large amounts of text, you are going to have to work hard to get perf problems. If you do have large amounts of text, you are going to be I/O bound (cache misses etc.) and at that point, the cost of any operation, is it's I/O. From that, Reading in some date, doing a single pass of processing on it and writing it back out would only take 2/3 long with translations on both side. -- ... <IXOYE><
Jun 07 2010