# Does Julia Create a "1.5" Language Problem?

**URL:** <https://discourse.julialang.org/t/does-julia-create-a-1-5-language-problem/107984>\
**Category:** Teaching & Outreach\
**Tags:** question, discussion\
**Created:** [December 23, 2023, 6:44pm UTC](https://discourse.julialang.org/t/does-julia-create-a-1-5-language-problem/107984 "2023-12-23T18:44:23Z")\
**Posts on this page:** 20\
**Page:** 3

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [December 28, 2023, 8:59am UTC](https://discourse.julialang.org/t/does-julia-create-a-1-5-language-problem/107984/43 "2023-12-28T08:59:14Z")

</div>

> [@cmichelenstrofer](#):
>
> that I am not surprised newcomers would be taken aback by _any_ Julia code that runs slower than Matlab/Python.

See [Frequently Asked Questions · The Julia Language](https://docs.julialang.org/en/v1/manual/faq/#Why-don't-you-compile-Matlab/Python/R/%E2%80%A6-code-to-Julia)

> Julia’s performance advantage derives almost entirely from its front-end: its language semantics allow a [well-written Julia program](https://docs.julialang.org/en/v1/manual/performance-tips/#man-performance-tips) to _give more opportunities to the compiler_ to generate efficient code and memory layouts. If you tried to compile Matlab or Python code to Julia, our compiler would be limited by the semantics of Matlab or Python to producing code no better than that of existing compilers for those languages (and probably worse).

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)\
**Post date:** [December 28, 2023, 9:42am UTC](https://discourse.julialang.org/t/does-julia-create-a-1-5-language-problem/107984/44 "2023-12-28T09:42:58Z")

</div>

“Walks like python, runs like C” is just a catchier phrase than “Can look like python under certain circumstances, can run like C under certain circumstances, can sometimes even look like python and run like C at the same time, although maximum performance usually needs more verbose code”. But that’s still a good value proposition.

---

<div class="post-metadata">

**Author:** ![xiaoxi](https://avatars.discourse-cdn.com/v4/letter/x/a9adbd/32.png) [@xiaoxi](https://discourse.julialang.org/u/xiaoxi)\
**Post date:** [December 28, 2023, 10:21am UTC](https://discourse.julialang.org/t/does-julia-create-a-1-5-language-problem/107984/45 "2023-12-28T10:21:29Z")

</div>

Like most programming languages, Julia could have a catchy slogan without an explicit comparison to other programming languages. For example, Rust’s slogan is “a language empowering everyone to build reliable and efficient software” and Python’s is “a programming language that lets you work quickly and integrate systems more effectively”. A slogan for Julia could focus on its growing importance in science and HPC.

---

<div class="post-metadata">

**Author:** ![Benny](https://avatars.discourse-cdn.com/v4/letter/b/49beb7/32.png) [@Benny](https://discourse.julialang.org/u/Benny)\
**Post date:** [December 28, 2023, 10:28am UTC](https://discourse.julialang.org/t/does-julia-create-a-1-5-language-problem/107984/46 "2023-12-28T10:28:27Z")

</div>

I don’t think Julia looks like Python much, even the most contrived examples omitting obvious differences, like classes vs structs, don’t look the same. “Walks like Python, runs like C” is just a catchphrase version of “a dynamically typed language that can be written to let a compiler infer types and optimize like a statically typed language”. For what it’s worth, that phrase doesn’t appear in official sources; the documentation’s first page outright says performant Julia is not like interpreted Python or R. I think the myth of optimized Python persists out of wishful thinking and is exploited by clickbait that distracts you from the fact that the reference implementation CPython has every incentive to pull this off but hasn’t. Even the aspirational Python superset Mojo doesn’t optimize Python code.

---

<div class="post-metadata">

**Author:** ![sob](https://avatars.discourse-cdn.com/v4/letter/s/65b543/32.png) [@sob](https://discourse.julialang.org/u/sob)\
**Post date:** [December 28, 2023, 10:40am UTC](https://discourse.julialang.org/t/does-julia-create-a-1-5-language-problem/107984/47 "2023-12-28T10:40:14Z")

</div>

My 2cts from personal experience coding in C/C++ a million years ago, in Python and then in Julia.

I was never good enough at C/C++ that I could write big programs fast, although I did like the ecosystem, workflow and speed.  
Writing Python, I would always stumble upon a speed problem, where I just couldn’t get any improvement easily for say hot loops of custom code. Extensions of the language solved some problems locally but felt more like patches here and there.  
In Julia I love that I can get to my desired output (ie implementation of functionalities) with minimal sweat. And if performance is not satisfactory, in can rethink bits of code here and there _within the same language_, by just being a bit more smart about how I do things. And without having to use some hacky stuff (or stuff that felt hacky) like in Python. So I think the 1.5 language is a bit misplaced, in the sense that everybody can write poor code in any language, but at least Julia allows you to get pretty close to C performance without massive re engineering (and dare I say with minimal effort) which is a huge benefit for what I do.

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)\
**Post date:** [December 28, 2023, 10:44am UTC](https://discourse.julialang.org/t/does-julia-create-a-1-5-language-problem/107984/48 "2023-12-28T10:44:11Z")

</div>

I never understood “looks like python” to mean exactly like python, more like simple syntax without too much boilerplate

---

<div class="post-metadata">

**Author:** ![KZiemian](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kziemian/32/9020_2.png) [@KZiemian](https://discourse.julialang.org/u/KZiemian)\
**Post date:** [December 28, 2023, 10:47am UTC](https://discourse.julialang.org/t/does-julia-create-a-1-5-language-problem/107984/49 "2023-12-28T10:47:42Z")

</div>

> [@Elrod](#):
>
> These are the sorts of things I want in Julia as well, and are broadly under the “static Julia” umbrella.

Can someone tell what is a “static Julia” status at this moment and its prospect for future? I don’t dare ask Julia team for more work on it, since they already working some miracles, from my point of view, for us.

---

<div class="post-metadata">

**Author:** ![KZiemian](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kziemian/32/9020_2.png) [@KZiemian](https://discourse.julialang.org/u/KZiemian)\
**Post date:** [December 28, 2023, 10:53am UTC](https://discourse.julialang.org/t/does-julia-create-a-1-5-language-problem/107984/50 "2023-12-28T10:53:28Z")

</div>

> [@anon56330260](#):
>
> In Julia, it’s easy to sliently introduce type instability, even for experienced user (transpose, eigen, type promotion, etc). So with a rather simple 1000-line type checker (implemented by recursively calling code\_typed), you can find a dozen of type instabilities in Julia’s type inferencer (yeah, I did this two years ago…).

Can you tell as more about your experiment?

---

<div class="post-metadata">

**Author:** ![hatmatrix](https://avatars.discourse-cdn.com/v4/letter/h/5f8ce5/32.png) [@hatmatrix](https://discourse.julialang.org/u/hatmatrix)\
**Post date:** [December 28, 2023, 11:10am UTC](https://discourse.julialang.org/t/does-julia-create-a-1-5-language-problem/107984/51 "2023-12-28T11:10:15Z")

</div>

> [@sob](#):
>
> write poor code in any language

My impression was that Fortran is one of those languages where poor code is not that bad, though someone’s bound to prove me wrong. Part of it comes from its simplicity which also restricts it to a limited set of use cases in intensive number-crunching but not for general purpose programming

---

<div class="post-metadata">

**Author:** ![liuyxpp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/liuyxpp/32/9870_2.png) [@liuyxpp](https://discourse.julialang.org/u/liuyxpp)\
**Post date:** [December 28, 2023, 1:57pm UTC](https://discourse.julialang.org/t/does-julia-create-a-1-5-language-problem/107984/52 "2023-12-28T13:57:17Z")

</div>

I share the same experience with you and I agree with you. Plus, Julia also enables me to tackle more hard problems/algorithms that I cannot even imagine I can even code with C++.

---

<div class="post-metadata">

**Author:** ![yvikhlya](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yvikhlya/32/3753_2.png) [@yvikhlya](https://discourse.julialang.org/u/yvikhlya)\
**Post date:** [December 28, 2023, 2:28pm UTC](https://discourse.julialang.org/t/does-julia-create-a-1-5-language-problem/107984/53 "2023-12-28T14:28:14Z")

</div>

The point made in the video, that developers can produce quick and dirty code or highly optimized/high performance code, is applicable to every programming language I know, so, saying that Julia introduces this problem is incorrect. Even fortran, which is also sold as a fast language, allows you to write slow code, which I see all over the project I work on. Modern Fortran compilers are smart enough though to forgive developers some errors. On the other hand, even modern Fortran lacks many advanced features, which Julia has, and will never have these features because of its legacy.

---

<div class="post-metadata">

**Author:** ![cmichelenstrofer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cmichelenstrofer/32/44392_2.png) [@cmichelenstrofer](https://discourse.julialang.org/u/cmichelenstrofer)\
**Post date:** [December 28, 2023, 3:02pm UTC](https://discourse.julialang.org/t/does-julia-create-a-1-5-language-problem/107984/54 "2023-12-28T15:02:08Z")

</div>

> [@yvikhlya](#):
>
> The point made in the video, that developers can produce quick and dirty code or highly optimized/high performance code, is applicable to every programming language I know

The point is not that Julia introduces a new problem that other languages do not. (The reality is actually the opposite, you can do both these things better in the same language). The point is that this belief (and subsequent disappointment) from _some_ newcomers is real. The anecdotes from the video and this thread show as much. I suspect that many that fall for this have, like myself, a science/engineering background rather than a programming background. If all you know is Matlab you don’t really have a grasp of what a language can or can’t do.

I’m not saying that anything needs to be done or changed, just that the presenter has a point. It is a real observable phenomenon.

---

<div class="post-metadata">

**Author:** ![yvikhlya](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yvikhlya/32/3753_2.png) [@yvikhlya](https://discourse.julialang.org/u/yvikhlya)\
**Post date:** [December 28, 2023, 3:35pm UTC](https://discourse.julialang.org/t/does-julia-create-a-1-5-language-problem/107984/55 "2023-12-28T15:35:31Z")

</div>

> [@cmichelenstrofer](#):
>
> The point is not that Julia introduces a new problem that other languages do not

This is exactly the point of the video, check the title:

> [@](#):
>
> [Julia solves the 2 language problem, however **it creates the 1.5 language problem**](https://www.youtube.com/watch?v=RUJFd-rEa0k)

I read this message literally and disagree with it. As for perception of Julia by newcomers, I agree, it may be frustrating at first, just because the whole Julia paradigm is so different from other languages, which some users got used to imo. May be documentation could do a better job explaining to newcomers what they can expect and what they can not. I am a newcomer myself and I can admit, that when I tried to solve my first real problem with Julia, I had some frustration as well, but not to the point that it turns me away.

---

<div class="post-metadata">

**Author:** ![yvikhlya](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yvikhlya/32/3753_2.png) [@yvikhlya](https://discourse.julialang.org/u/yvikhlya)\
**Post date:** [December 28, 2023, 3:50pm UTC](https://discourse.julialang.org/t/does-julia-create-a-1-5-language-problem/107984/56 "2023-12-28T15:50:39Z")

</div>

May be confusing part for newcomers is an advertising that they can write a code as in Matlab and it will be as fast as Fortran code, which is not true, because Julia is so different from Matlab. Performant Julia code may be as concise as Matlab, or have somewhat similar syntax to Matlab, but it is not exactly as Matlab. Copying Matlab code to Julia 1-to-1 results in poor performance. This is something that newcomers should understand and adjust their expectations.

---

<div class="post-metadata">

**Author:** ![cmichelenstrofer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cmichelenstrofer/32/44392_2.png) [@cmichelenstrofer](https://discourse.julialang.org/u/cmichelenstrofer)\
**Post date:** [December 28, 2023, 4:31pm UTC](https://discourse.julialang.org/t/does-julia-create-a-1-5-language-problem/107984/57 "2023-12-28T16:31:51Z")

</div>

You are saying the same thing the video said. Like, exactly the same. There is an expectation mismatch. The video never poses the “1.5 language problem” as an actual problem to be solved. It is not a critique of Julia. It merely points out a real expectation mismatch that _some_ newcomers experience that turn them off the language. The presenter argues we should address this. I’m not sure anything more needs to be done at the official level, but this realistic expectation is something I make sure to convey to people I’m trying to convert.

---

<div class="post-metadata">

**Author:** ![cmichelenstrofer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cmichelenstrofer/32/44392_2.png) [@cmichelenstrofer](https://discourse.julialang.org/u/cmichelenstrofer)\
**Post date:** [December 28, 2023, 5:16pm UTC](https://discourse.julialang.org/t/does-julia-create-a-1-5-language-problem/107984/58 "2023-12-28T17:16:40Z")

</div>

Final thought on this topic. Using the language from the presentation I do think Julia introduces a “1.5 language problem”(benign problem) precisely because it solves the two language problem. This is a good thing. The two language problem cannot be solved with a “single” language in the sense that rapid prototyping and performant code will always be different. But Julia comes as close as possible (no one else comes close). You can do both in the same language! But it is indeed two different efforts. As described by Chris R above.

The scenario Chris described is great but I think another good scenario is small research groups that do not have a “dev team”. Julia gives you a way to slowly make your code more performant while staying in the same language! This is a huge incentive for scientists/engineers to actually learn how to write performant code (journey I’m in) and learn more CS concepts (scientists/engineers need to accept we need more CS skills and while we are at it, math…).

That being said in an ideal world I would have both, my code look like the equations and run as fast as possible.

---

<div class="post-metadata">

**Author:** ![oscarvdvelde](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oscarvdvelde/32/202157_2.png) [@oscarvdvelde](https://discourse.julialang.org/u/oscarvdvelde)\
**Post date:** [December 28, 2023, 7:08pm UTC](https://discourse.julialang.org/t/does-julia-create-a-1-5-language-problem/107984/59 "2023-12-28T19:08:22Z")

</div>

As newcomer to Julia, one of the first things I did was study the Performance page of the manual.  
However, it did not prevent me from coming up with code like this, and wondering how this suddenly could take 40 seconds instead of two. After this, I learned that more compact, intuitive code is not necessarily fast:

(here, cellperpoint had 405\_000 elements, activecells 3449 and indices is a BitVector that would select ~half the entries of cellperpoint):

```julia
@btime cellpoints = [cellperpoint[indices].== cell for cell in activecells]
  3.032 s (31046 allocations: 4.92 GiB)
3449-element Vector{BitVector}:

```

while:

```julia
@btime cellpoints = [cellperpoint.== cell for cell in activecells]
 472.810 ms (24148 allocations: 117.39 MiB)

```

It seems that Julia unnecessarily re-evaluated the indexing on every iteration. So my solution was to save cellperpoint[indices] to a variable first, then placing that in the comprehension, and get 236 ms, i.e. a 13-time speedup here.

Perhaps Matlab would have evaluated the indices once, before the iteration? Why couldn’t Julia do that automatically, given that neither variable changed within the comprehension?

---

<div class="post-metadata">

**Author:** ![Eben60](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/eben60/32/13475_2.png) [@Eben60](https://discourse.julialang.org/u/Eben60)\
**Post date:** [December 28, 2023, 7:50pm UTC](https://discourse.julialang.org/t/does-julia-create-a-1-5-language-problem/107984/60 "2023-12-28T19:50:06Z")

</div>

is it possible that `indices` is a global?

---

<div class="post-metadata">

**Author:** ![KZiemian](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kziemian/32/9020_2.png) [@KZiemian](https://discourse.julialang.org/u/KZiemian)\
**Post date:** [December 28, 2023, 8:30pm UTC](https://discourse.julialang.org/t/does-julia-create-a-1-5-language-problem/107984/61 "2023-12-28T20:30:05Z")

</div>

> [@anon56330260](#):
>
> That’s why I lost my last hope : Julia community is too niche to attract a diverse CS user group.

Very sad statement. I hope that we can prosper in our niche regardless of that.

---

<div class="post-metadata">

**Author:** ![anon56330260](https://avatars.discourse-cdn.com/v4/letter/a/f07891/32.png) [@anon56330260](https://discourse.julialang.org/u/anon56330260)\
**Post date:** [December 28, 2023, 8:43pm UTC](https://discourse.julialang.org/t/does-julia-create-a-1-5-language-problem/107984/62 "2023-12-28T20:43:27Z")

</div>

So around two years ago, I started a hobby project to use LLVM’s new JIT framework to produce small binaries for Julia (warning : it failed).

Crash course for Julia’s compiler in case that you don’t know how it works: Julia source code is firstly translated to IR (much like bytecode in Java). Type inferencer (implemented in Julia) adds type annotation to the IR. Then this typed IR is emitted to machine code by LLVM.

The workflow is like this:

1. Compile the type inferencer by caching all IRs from the type inferencer and emit LLVM binary code, then discard all IRs and method tables.
2. Build my own base/stdlib library with only selected functionality (by including relevant source files). So I can remove unused dependencies and further speed up compilation.

And it turns out…the type inferencer itself was type unstable in several places, including some common mistakes like unhandled union splitting (Any is not splitted against complicated method signatures), closure and so on. So I can’t discard method tables for the type inferencer because dynamic dispatch needs to look up method tables.

I achieved this by a simple script because at that time `Cthulhu.jl` is not automatic enough at this task. :

```julia
for each IR in code_typed(function call):
    if IR is a dynamic dispatch function call:
        extract source code information from function's debug table
        print human readable error
    else if IR is static function call:
        recur into function call if the signature combination is not seen before
    end
end

```

It generates a list a possible error and source location. So in vscode I can quickly jump to the location and fix errors as many as possible, then start a new round.

I eventually gave up and decided to simply file an issue on github, because I didn’t want to patch Julia’s type inferencer – it complicated my workflow, and honestly speaking, I would rather rewrite the type inferencer in C++ instead of patching it in Julia, because it’s so inconvenient to boostrap the type inferencer and debug it.

Another experiement I did is to design a AST type inferencer for Julia (again, a simple 2000 lines type checker that can be implemented by any PL undergraduate). The lesson I learned from my previous experiment is that : IR type checker is essentially unusable because IR is not designed for human and the output is hard to interpret. So this time I set up some restricted syntax rules to systematically decide what should be considered as “type stable”.

I used it to scan some small packages, the result is surprising : many packages are not well typed and made small dump mistakes. Some people have hard time with parameterized type and forget to supply enough parameters. This is contrary to what people usually claim in the discourse. I fixed them manually by opening an issue on gihub. But then I got tired - it’s just not my duty to fix errors for other people and this way doesn’t scale. People should do this by themselves as they know more context than me.

I also tested it on my legacy computer graphics code, a tiny ray tracer. I caught two errors (one caused by type conversion and one by misspell) in the hot loop. IR checker simply can’t detect this because Julia silently does union splitting and the final result has no dispatch.

Anyway, none of these requires nontrivial PL techniques. Basically every of my PL friends know this as undergraduate, and one of them developed Julia’s Jetbrain plugin… That’s why I said a niche community is a huge problem. You need to spend more time and more effect to achieve the same thing…

[Previous page](https://discourse.julialang.org/t/does-julia-create-a-1-5-language-problem/107984.md?page=2)

[Next page](https://discourse.julialang.org/t/does-julia-create-a-1-5-language-problem/107984.md?page=4)
