Use of String type
Closed this issue · 2 comments
In general, you'll want to use the ASCIIString
or UTF8String
types in your code, rather than the more generic String
type. Judging from your current code, ASCIIString
should suffice.
Thanks for the note. Could you elaborate or share some link where would be described why this is better? (More efficient?) That is solely for my education, because now I would just blindly change the String
to something else.
Here's the relevant performance tip: http://docs.julialang.org/en/latest/manual/performance-tips/#declare-specific-types-for-fields-of-composite-types
String is an abstract type, so there's no way to fully specialize on it when the compiler's emitting code. For String's, this isn't so bad, but it's a good habit to get into for other types where there could be a huge performance loss when using abstract types rather than concrete types.