# Is Julia well-suited for string manipulation?

**URL:** <https://discourse.julialang.org/t/is-julia-well-suited-for-string-manipulation/92943>\
**Category:** General Usage\
**Tags:** strings\
**Created:** [January 13, 2023, 4:43pm UTC](https://discourse.julialang.org/t/is-julia-well-suited-for-string-manipulation/92943 "2023-01-13T16:43:02Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [January 13, 2023, 5:25pm UTC](https://discourse.julialang.org/t/is-julia-well-suited-for-string-manipulation/92943/2 "2023-01-13T17:25:25Z")

</div>

> [@jules](#):
>
> Why do I sometimes read that Julia is not particularly well suited for string manipulation? I read about Perl or Python being good at that but I’ve never seen a technical explanation what puts Julia at a disadvantage performance-wise.

I don’t think Julia is at an inherent disadvantage — you can certainly write heavily optimized text-processing code like [CSV.jl](https://github.com/JuliaData/CSV.jl) and [Parsers.jl](https://github.com/JuliaData/Parsers.jl) in Julia. For example, a few years back I helped optimize a Japanese tokenizer called [TinySegmenter.jl](https://github.com/JuliaStrings/TinySegmenter.jl), and the result was considerably faster than optimized implementations of a similar algorithm in Ruby, Python, and Perl.

However, if you write naive string-processing code in Julia, using the same style as Python, allocating zillions of temporary strings, then Julia performs worse — the language isn’t designed for code that does lots of small allocations in critical inner loops. It’s similar to people who port numerical code from Matlab (or Numpy) to Julia line-by-line, and often find that their initial Julia port is slower, as in this recent thread for example: [MATLAB outperforms Julia (20 times faster) running this nested loop](https://discourse.julialang.org/t/matlab-outperforms-julia-20-times-faster-running-this-nested-loop/92691)

Of course, for particular tasks a particular language may benefit from some heavily optimized library, for which Julia does not yet have an equivalent. It’s also true that the majority of people writing high-performance libraries for Julia have thus far been focused more on numerical computations than text processing.

---

_[View the full topic](https://discourse.julialang.org/t/is-julia-well-suited-for-string-manipulation/92943)._
