Julia can process text similar to Perl

Does Julia have the same word processing functions as Perl?

I’m not sure what you are looking for.

I converted a major log parser from Perl to Julia. The Julia version is running 10 times as fast as was the Perl one. Some of that speedup was from algorithm changes but much was from the inherent efficiency of the Julia compiler.

Julia has very good support for regexes…


@js135005 that’s very interesting experience! Nice to see Julia shine there.

No doubt the Julia compiler is a big advantage. Perl does have the advantage of in-place string operations, as strings are mutable in Perl and immutable in Julia. Did you notice the effects of that on you algorithms?

Another very nice thing that perl has are the command line options -i, -n and -p which make it very nice to just edit files line-by-line without writing the boilerplate loops. @Marks if that’s what you are looking for, I think Julia doesn’t have it.

I just spent a few days moving StatProfilerHTML from Perl to Julia. It has far, far fewer lines of code now :slight_smile: but I haven’t done any performance benchmarking.

1 Like

It is unclear what you mean here, please explain. Julia has the standard string handling functionality most languages have, including regular expressions. You may want to read


I used to do a lot of Perl programming, including lots of text processing, and yes, you can do everything in Julia that you can do in Perl.


This is the only reason why I still write some Perl these days:

perl -pn -i.bak -e "SOME ONE-LINER;" INPUT_FILE
1 Like

I suspect the same could be accomplished in Julia by a combination of:

  • a command line flags for loading certain modules
  • macros that do those one-liners

But of course, Perl’s startup time is unbeatable (0.01s). Julia’s is not bad by itself (0.07s), but if you’re loading a package as well then it gets slower. So I still write one-liners in Perl.

1 Like

Practical Extraction and Reporting Language of course. It’s Camels for Courses.

I will fetch my own coat.
(To explain the joke, the English expression is horses for courses. The Oreilly Perl book had a camel on the front page.)


I can’t get Julia 1.3.1 to startup faster than 0.13 seconds (-O0 and --compile=no). Are there improvements in that dimension in 1.4/1.5?

Don’t forget -startup=no. I did at first. I’m assuming you didn’t though, because 0.13s is pretty good.

> time -p julia -E 'VERSION'
real 0.29
user 0.23
sys 0.05
> time -p julia --startup=no -E 'VERSION'
real 0.13
user 0.07
sys 0.04
> time -p julia --startup=no --compile=min -E 'VERSION'
real 0.10
user 0.03
sys 0.04

Not quite 0.07s. Repeating it a total of 6 times, I hit 0.08s twice.
If the computer were faster, it could’ve hit 0.07s.
This desktop has 4.6 GHz sse speed, so not too many computers should be faster. Many laptops will be twice as slow or more.

Fwiw, I edited my post. I had accidentally typed -O3 when I meant -O0 which makes a small but measurable difference.

Ah. I just wrote a loop to run it 10 times, adding -O0 to the above. The first one returned 0.10s. Out of the remaining nine, 3/9 were 0.07s and 6/9 were 0.08s.

Sorry, I was reading the wrong number in zsh’s time output:

bash-3.2$ time julia -e0

real	0m0.158s
user	0m0.086s
sys	0m0.079s