Mojo is a new LLVM programming language designed as a superset of Python with the low-level performance of C. It is optimized to run on GPUs with CUDA and other exotic hardware for deep learning and Artificial Intelligence.  

#programming #tech #thecodereport 

💬 Chat with Me on Discord

https://discord.gg/fireship

🔗 Resources

- Mojo Language https://www.modular.com/mojo
- @howardjeremyp Mojo Video https://youtu.be/6GvB5lZJqcE 
- LLVM in 100 Seconds https://youtu.be/BT2Cv-Tjq7Q
- Python in 100 Seconds https://youtu.be/x7X9w_GIm1s
- Linear Algebra for Programmers https://youtu.be/bOCHTHkBoAs

🔥 Get More Content - Upgrade to PRO

Upgrade at https://fireship.io/pro
Use code YT25 for 25% off PRO access 

🎨 My Editor Settings

- Atom One Dark 
- vscode-icons
- Fira Code Font

🔖 Topics Covered

- What is Mojo Language?
- Best Python alternative
- Is python slow?
- Futuristic AI programming languages
- Is mojo a python killer?
- Mojo vs Python
- Mojo vs Rust
- Mojo vs C++
2024-02-04T05:06:45.917Z
nova-2
2-general-nova
2024-01-09.29447
30089e05-99d1-4376-b32e-c263170674af
16d6646e-73c4-48c8-8362-8ed048245d0f
d1a9d7e2d807a463bac7292e37fcd8b6323b83982a0486972d08f1c9a3a80392
67875a7f-c9c4-48a0-aa55-5bdb8a91c34a
deprecated
It is May 4, 2023 and you're watching the Code Report.
Python is a wonderful language for productive programming, but it has one big problem.
It's too slow.
And going slow means you'll get made fun of by the Rust and c plus plus chads of the world.
But the tables are about to turn thanks to a brand new programming language called Mojo, a superset of Python that's not just 2 times faster, not 10 times faster, but up to 35000 times faster than your Grandpa's Python.
And that's a huge deal because Python's the dominant language for artificial intelligence, but behind the curtain, anything that needs to go fast is written in c or c+.
Us.
In today's video, we'll take Mojo for a spin, but first, here are 5 things that you need to know about it.
1, this is not some random guy's side project on GitHub, but rather it comes from a company founded by Chris Lattner, the guy who created the Swift programming language and the LLVM compiler tool chain.
If anybody could fix Python's problems, it's him.
And if you have no idea what LLVM is, check out this video.
2, it's a language designed for programming on AI hardware, like GPUs running CUDA and other accelerators.
It achieves this by leveraging multi level intermediate representation to scale to exotic hardware types without a ton of complexity.
And it even has built in auto tuning to optimize your code for your target hardware.
3, it's designed as a super set of Python, in the same way TypeScript is a superset of JavaScript, so you don't need to learn another language to take advantage of it.
And this is unique compared to other modern systems languages like Rust, Zig, NIM, and so on, which would have a higher learning curve for existing Python programmers.
It does have a bunch of features on top of Python, on, like, var and let declarations and structs, but the base language is fully compatible with Python.
And it can also interop with the Python ecosystem, which means you can still use your favorite libraries like NumPy, Pandas, etcetera.
4, it adds strong type checking to the language.
You can still use dynamic types if you prefer, but Static types are essential for optimized performance and error checking.
For memory management, it has an ownership system and borrow checker similar to Rust and also supports manual memory management with pointers like c plus plus It's a pragmatic language that gives you safety, but also the flexibility to be unsafe when needed.
Now the final thing to know is that currently, it's not mobile to the public.
It's still in very early development.
It will be open sourced in the future, but currently there's a wait list to try it out.
I was lucky enough to get early access, so let's fire To run it, you can create a file ending in dotmojo or dot fire emoji.
That's a huge advantage over Python, which doesn't allow you to name your files in dot snake, but we It can also run the code in a Jupyter notebook, where it behaves like an interpreted language.
Here, we have a matrix multiplication demo that computes a dot product to demonstrate straight the crazy performance gains we get with Mojo.
1st, it benchmarks a basic function in Python, then by simply importing that code into Mojo, It's executed 14 times faster with no modifications to the code, but we're only just getting started.
We can further optimize this code by adding types to the Python implementation.
Mojo allows us to do that with its built in struct keyword.
A struct is very similar to a Python class, but structs are static unlike classes which are dynamic.
Inside Side the struct, we also have keywords like var and let, which can define mutable and immutable variables, and def is replaced with f n, which is a stricter your type of function.
Also notice single instruction multiple data, which is a built in type that represents a vector where a single instruction can be executed across multiple elements in parallel on the underlying line hardware.
Once we have this struct, we can then use it as a type in the Python implementation.
Then when we benchmark the code again, we get a ridiculous 500 x performance boost, but we're still not happy yet.
In the inner loop, we can query the vector width instead of hard coding it, and that gives us a 1,000 x gain, but that's nothing compared to what we're about to do.
Linear algebra is perfect for parallel computing, and we can easily make our code multi threaded with the built in parallelize function, increasing our speed buff to 2,000 x.
But now I've got a fever, and the only prescription is more performance.
Luckily, Mojo has built in tiling utilities that Basically, allow us to cache and reuse data more efficiently, and we can even auto tune it to find the optimal parameters for our hardware.
The end result is over 4,000 times faster execution compared to the original Python code.
That's pretty crazy, and if you wanna see this code broken down in greater detail, I'd highly recommend this video from Jeremy Howard.
Mihoward.
But I'm curious what you guys think.
Do you really think Mojo could kill Python and c+ at the same time?
I'm a bit skeptical, but employers are already hiring Mojo developers with 10 and years of experience.
This has been the code report.
Thanks for watching, and I will see you in the next one.

Speaker 0: It is May 4, 2023 and you're watching the Code Report. Python is a wonderful language for productive programming, but it has one big problem. It's too slow. And going slow means you'll get made fun of by the Rust and c plus plus chads of the world. But the tables are about to turn thanks to a brand new programming language called Mojo, a superset of Python that's not just 2 times faster, not 10 times faster, but up to 35000 times faster than your Grandpa's Python.

And that's a huge deal because Python's the dominant language for artificial intelligence, but behind the curtain, anything that needs to go fast is written in c or c+. Us. In today's video, we'll take Mojo for a spin, but first, here are 5 things that you need to know about it. 1, this is not some random guy's side project on GitHub, but rather it comes from a company founded by Chris Lattner, the guy who created the Swift programming language and the LLVM compiler tool chain. If anybody could fix Python's problems, it's him.

And if you have no idea what LLVM is, check out this video. 2, it's a language designed for programming on AI hardware, like GPUs running CUDA and other accelerators. It achieves this by leveraging multi level intermediate representation to scale to exotic hardware types without a ton of complexity. And it even has built in auto tuning to optimize your code for your target hardware. 3, it's designed as a super set of Python, in the same way TypeScript is a superset of JavaScript, so you don't need to learn another language to take advantage of it.

And this is unique compared to other modern systems languages like Rust, Zig, NIM, and so on, which would have a higher learning curve for existing Python programmers. It does have a bunch of features on top of Python, on, like, var and let declarations and structs, but the base language is fully compatible with Python. And it can also interop with the Python ecosystem, which means you can still use your favorite libraries like NumPy, Pandas, etcetera. 4, it adds strong type checking to the language. You can still use dynamic types if you prefer, but Static types are essential for optimized performance and error checking.

For memory management, it has an ownership system and borrow checker similar to Rust and also supports manual memory management with pointers like c plus plus It's a pragmatic language that gives you safety, but also the flexibility to be unsafe when needed. Now the final thing to know is that currently, it's not mobile to the public. It's still in very early development. It will be open sourced in the future, but currently there's a wait list to try it out. I was lucky enough to get early access, so let's fire To run it, you can create a file ending in dotmojo or dot fire emoji.

That's a huge advantage over Python, which doesn't allow you to name your files in dot snake, but we It can also run the code in a Jupyter notebook, where it behaves like an interpreted language. Here, we have a matrix multiplication demo that computes a dot product to demonstrate straight the crazy performance gains we get with Mojo. 1st, it benchmarks a basic function in Python, then by simply importing that code into Mojo, It's executed 14 times faster with no modifications to the code, but we're only just getting started. We can further optimize this code by adding types to the Python implementation. Mojo allows us to do that with its built in struct keyword.

A struct is very similar to a Python class, but structs are static unlike classes which are dynamic. Inside Side the struct, we also have keywords like var and let, which can define mutable and immutable variables, and def is replaced with f n, which is a stricter your type of function. Also notice single instruction multiple data, which is a built in type that represents a vector where a single instruction can be executed across multiple elements in parallel on the underlying line hardware. Once we have this struct, we can then use it as a type in the Python implementation. Then when we benchmark the code again, we get a ridiculous 500 x performance boost, but we're still not happy yet.

In the inner loop, we can query the vector width instead of hard coding it, and that gives us a 1,000 x gain, but that's nothing compared to what we're about to do. Linear algebra is perfect for parallel computing, and we can easily make our code multi threaded with the built in parallelize function, increasing our speed buff to 2,000 x. But now I've got a fever, and the only prescription is more performance. Luckily, Mojo has built in tiling utilities that Basically, allow us to cache and reuse data more efficiently, and we can even auto tune it to find the optimal parameters for our hardware. The end result is over 4,000 times faster execution compared to the original Python code.

That's pretty crazy, and if you wanna see this code broken down in greater detail, I'd highly recommend this video from Jeremy Howard. Mihoward. But I'm curious what you guys think. Do you really think Mojo could kill Python and c+ at the same time? I'm a bit skeptical, but employers are already hiring Mojo developers with 10 and years of experience.

This has been the code report. Thanks for watching, and I will see you in the next one.
It is May 4, 2023 and you're watching the Code Report. Python is a wonderful language for productive programming, but it has one big problem. It's too slow. And going slow means you'll get made fun of by the Rust and c plus plus chads of the world. But the tables are about to turn thanks to a brand new programming language called Mojo, a superset of Python that's not just 2 times faster, not 10 times faster, but up to 35000 times faster than your Grandpa's Python.
And that's a huge deal because Python's the dominant language for artificial intelligence, but behind the curtain, anything that needs to go fast is written in c or c+. Us. In today's video, we'll take Mojo for a spin, but first, here are 5 things that you need to know about it.
artificial intelligence
deep learning
machine learning
neural networks
computer science
1, this is not some random guy's side project on GitHub, but rather it comes from a company founded by Chris Lattner, the guy who created the Swift programming language and the LLVM compiler tool chain.
If anybody could fix Python's problems, it's him. And if you have no idea what LLVM is, check out this video. 2, it's a language designed for programming on AI hardware, like GPUs running CUDA and other accelerators. It achieves this by leveraging multi level intermediate representation to scale to exotic hardware types without a ton of complexity. And it even has built in auto tuning to optimize your code for your target hardware. 3, it's designed as a super set of Python, in the same way TypeScript is a superset of JavaScript, so you don't need to learn another language to take advantage of it. And this is unique compared to other modern systems languages like Rust, Zig, NIM, and so on, which would have a higher learning curve for existing Python programmers. It does have a bunch of features on top of Python, on, like, var and let declarations and structs, but the base language is fully compatible with Python. And it can also interop with the Python ecosystem, which means you can still use your favorite libraries like NumPy, Pandas, etcetera. 4, it adds strong type checking to the language. You can still use dynamic types if you prefer, but Static types are essential for optimized performance and error checking.
languages
programming
For memory management, it has an ownership system and borrow checker similar to Rust and also supports manual memory management with pointers like c plus plus It's a pragmatic language that gives you safety, but also the flexibility to be unsafe when needed. Now the final thing to know is that currently, it's not mobile to the public. It's still in very early development. It will be open sourced in the future, but currently there's a wait list to try it out. I was lucky enough to get early access, so let's fire To run it, you can create a file ending in dotmojo or dot fire emoji.
That's a huge advantage over Python, which doesn't allow you to name your files in dot snake, but we It can also run the code in a Jupyter notebook, where it behaves like an interpreted language. Here, we have a matrix multiplication demo that computes a dot product to demonstrate straight the crazy performance gains we get with Mojo. 1st, it benchmarks a basic function in Python, then by simply importing that code into Mojo, It's executed 14 times faster with no modifications to the code, but we're only just getting started.
programming
neural networks
We can further optimize this code by adding types to the Python implementation. Mojo allows us to do that with its built in struct keyword. A struct is very similar to a Python class, but structs are static unlike classes which are dynamic. Inside Side the struct, we also have keywords like var and let, which can define mutable and immutable variables, and def is replaced with f n, which is a stricter your type of function.
Also notice single instruction multiple data, which is a built in type that represents a vector where a single instruction can be executed across multiple elements in parallel on the underlying line hardware. Once we have this struct, we can then use it as a type in the Python implementation. Then when we benchmark the code again, we get a ridiculous 500 x performance boost, but we're still not happy yet. In the inner loop, we can query the vector width instead of hard coding it, and that gives us a 1,000 x gain, but that's nothing compared to what we're about to do. Linear algebra is perfect for parallel computing, and we can easily make our code multi threaded with the built in parallelize function, increasing our speed buff to 2,000 x. But now I've got a fever, and the only prescription is more performance. Luckily, Mojo has built in tiling utilities that Basically, allow us to cache and reuse data more efficiently, and we can even auto tune it to find the optimal parameters for our hardware.
programming
networking
The end result is over 4,000 times faster execution compared to the original Python code. That's pretty crazy, and if you wanna see this code broken down in greater detail, I'd highly recommend this video from Jeremy Howard. Mihoward. But I'm curious what you guys think. Do you really think Mojo could kill Python and c+ at the same time? I'm a bit skeptical, but employers are already hiring Mojo developers with 10 and years of experience. This has been the code report. Thanks for watching, and I will see you in the next one.
It is May 4, 2023 and you're watching the Code Report. Python is a wonderful language for productive programming, but it has one big problem. It's too slow. And going slow means you'll get made fun of by the Rust and c plus plus chads of the world. But the tables are about to turn thanks to a brand new programming language called Mojo, a superset of Python that's not just 2 times faster, not 10 times faster, but up to 35000 times faster than your Grandpa's Python. And that's a huge deal because Python's the dominant language for artificial intelligence, but behind the curtain, anything that needs to go fast is written in c or c+. Us. In today's video, we'll take Mojo for a spin, but first, here are 5 things that you need to know about it. 1, this is not some random guy's side project on GitHub, but rather it comes from a company founded by Chris Lattner, the guy who created the Swift programming language and the LLVM compiler tool chain. If anybody could fix Python's problems, it's him. And if you have no idea what LLVM is, check out this video. 2, it's a language designed for programming on AI hardware, like GPUs running CUDA and other accelerators. It achieves this by leveraging multi level intermediate representation to scale to exotic hardware types without a ton of complexity. And it even has built in auto tuning to optimize your code for your target hardware. 3, it's designed as a super set of Python, in the same way TypeScript is a superset of JavaScript, so you don't need to learn another language to take advantage of it. And this is unique compared to other modern systems languages like Rust, Zig, NIM, and so on, which would have a higher learning curve for existing Python programmers. It does have a bunch of features on top of Python, on, like, var and let declarations and structs, but the base language is fully compatible with Python. And it can also interop with the Python ecosystem, which means you can still use your favorite libraries like NumPy, Pandas, etcetera. 4, it adds strong type checking to the language. You can still use dynamic types if you prefer, but Static types are essential for optimized performance and error checking. For memory management, it has an ownership system and borrow checker similar to Rust and also supports manual memory management with pointers like c plus plus It's a pragmatic language that gives you safety, but also the flexibility to be unsafe when needed. Now the final thing to know is that currently, it's not mobile to the public. It's still in very early development. It will be open sourced in the future, but currently there's a wait list to try it out. I was lucky enough to get early access, so let's fire To run it, you can create a file ending in dotmojo or dot fire emoji. That's a huge advantage over Python, which doesn't allow you to name your files in dot snake, but we It can also run the code in a Jupyter notebook, where it behaves like an interpreted language. Here, we have a matrix multiplication demo that computes a dot product to demonstrate straight the crazy performance gains we get with Mojo. 1st, it benchmarks a basic function in Python, then by simply importing that code into Mojo, It's executed 14 times faster with no modifications to the code, but we're only just getting started. We can further optimize this code by adding types to the Python implementation. Mojo allows us to do that with its built in struct keyword. A struct is very similar to a Python class, but structs are static unlike classes which are dynamic. Inside Side the struct, we also have keywords like var and let, which can define mutable and immutable variables, and def is replaced with f n, which is a stricter your type of function. Also notice single instruction multiple data, which is a built in type that represents a vector where a single instruction can be executed across multiple elements in parallel on the underlying line hardware. Once we have this struct, we can then use it as a type in the Python implementation. Then when we benchmark the code again, we get a ridiculous 500 x performance boost, but we're still not happy yet. In the inner loop, we can query the vector width instead of hard coding it, and that gives us a 1,000 x gain, but that's nothing compared to what we're about to do. Linear algebra is perfect for parallel computing, and we can easily make our code multi threaded with the built in parallelize function, increasing our speed buff to 2,000 x. But now I've got a fever, and the only prescription is more performance. Luckily, Mojo has built in tiling utilities that Basically, allow us to cache and reuse data more efficiently, and we can even auto tune it to find the optimal parameters for our hardware. The end result is over 4,000 times faster execution compared to the original Python code. That's pretty crazy, and if you wanna see this code broken down in greater detail, I'd highly recommend this video from Jeremy Howard. Mihoward. But I'm curious what you guys think. Do you really think Mojo could kill Python and c+ at the same time? I'm a bit skeptical, but employers are already hiring Mojo developers with 10 and years of experience. This has been the code report. Thanks for watching, and I will see you in the next one.
It
it
is
is
May
may
4,
4
2023
2023
and
and
you're
you're
watching
watching
the
the
Code
code
Report.
report
Python
python
is
is
a
a
wonderful
wonderful
language
language
for
for
productive
productive
programming,
programming
but
but
it
it
has
has
one
one
big
big
problem.
problem
It's
it's
too
too
slow.
slow
And
and
going
going
slow
slow
means
means
you'll
you'll
get
get
made
made
fun
fun
of
of
by
by
the
the
Rust
rust
and
and
c
c
plus
plus
plus
plus
chads
chads
of
of
the
the
world.
world
But
but
the
the
tables
tables
are
are
about
about
to
to
turn
turn
thanks
thanks
to
to
a
a
brand
brand
new
new
programming
programming
language
language
called
called
Mojo,
mojo
a
a
superset
superset
of
of
Python
python
that's
that's
not
not
just
just
2
2
times
times
faster,
faster
not
not
10
10
times
times
faster,
faster
but
but
up
up
to
to
35000
35000
times
times
faster
faster
than
than
your
your
Grandpa's
grandpa's
Python.
python
And
and
that's
that's
a
a
huge
huge
deal
deal
because
because
Python's
python's
the
the
dominant
dominant
language
language
for
for
artificial
artificial
intelligence,
intelligence
but
but
behind
behind
the
the
curtain,
curtain
anything
anything
that
that
needs
needs
to
to
go
go
fast
fast
is
is
written
written
in
in
c
c
or
or
c+.
c+
Us.
us
In
in
today's
today's
video,
video
we'll
we'll
take
take
Mojo
mojo
for
for
a
a
spin,
spin
but
but
first,
first
here
here
are
are
5
5
things
things
that
that
you
you
need
need
to
to
know
know
about
about
it.
it
1,
1
this
this
is
is
not
not
some
some
random
random
guy's
guy's
side
side
project
project
on
on
GitHub,
github
but
but
rather
rather
it
it
comes
comes
from
from
a
a
company
company
founded
founded
by
by
Chris
chris
Lattner,
lattner
the
the
guy
guy
who
who
created
created
the
the
Swift
swift
programming
programming
language
language
and
and
the
the
LLVM
llvm
compiler
compiler
tool
tool
chain.
chain
If
if
anybody
anybody
could
could
fix
fix
Python's
python's
problems,
problems
it's
it's
him.
him
And
and
if
if
you
you
have
have
no
no
idea
idea
what
what
LLVM
llvm
is,
is
check
check
out
out
this
this
video.
video
2,
2
it's
it's
a
a
language
language
designed
designed
for
for
programming
programming
on
on
AI
ai
hardware,
hardware
like
like
GPUs
gpus
running
running
CUDA
cuda
and
and
other
other
accelerators.
accelerators
It
it
achieves
achieves
this
this
by
by
leveraging
leveraging
multi
multi
level
level
intermediate
intermediate
representation
representation
to
to
scale
scale
to
to
exotic
exotic
hardware
hardware
types
types
without
without
a
a
ton
ton
of
of
complexity.
complexity
And
and
it
it
even
even
has
has
built
built
in
in
auto
auto
tuning
tuning
to
to
optimize
optimize
your
your
code
code
for
for
your
your
target
target
hardware.
hardware
3,
3
it's
it's
designed
designed
as
as
a
a
super
super
set
set
of
of
Python,
python
in
in
the
the
same
same
way
way
TypeScript
typescript
is
is
a
a
superset
superset
of
of
JavaScript,
javascript
so
so
you
you
don't
don't
need
need
to
to
learn
learn
another
another
language
language
to
to
take
take
advantage
advantage
of
of
it.
it
And
and
this
this
is
is
unique
unique
compared
compared
to
to
other
other
modern
modern
systems
systems
languages
languages
like
like
Rust,
rust
Zig,
zig
NIM,
nim
and
and
so
so
on,
on
which
which
would
would
have
have
a
a
higher
higher
learning
learning
curve
curve
for
for
existing
existing
Python
python
programmers.
programmers
It
it
does
does
have
have
a
a
bunch
bunch
of
of
features
features
on
on
top
top
of
of
Python,
python
on,
on
like,
like
var
var
and
and
let
let
declarations
declarations
and
and
structs,
structs
but
but
the
the
base
base
language
language
is
is
fully
fully
compatible
compatible
with
with
Python.
python
And
and
it
it
can
can
also
also
interop
interop
with
with
the
the
Python
python
ecosystem,
ecosystem
which
which
means
means
you
you
can
can
still
still
use
use
your
your
favorite
favorite
libraries
libraries
like
like
NumPy,
numpy
Pandas,
pandas
etcetera.
etcetera
4,
4
it
it
adds
adds
strong
strong
type
type
checking
checking
to
to
the
the
language.
language
You
you
can
can
still
still
use
use
dynamic
dynamic
types
types
if
if
you
you
prefer,
prefer
but
but
Static
static
types
types
are
are
essential
essential
for
for
optimized
optimized
performance
performance
and
and
error
error
checking.
checking
For
for
memory
memory
management,
management
it
it
has
has
an
an
ownership
ownership
system
system
and
and
borrow
borrow
checker
checker
similar
similar
to
to
Rust
rust
and
and
also
also
supports
supports
manual
manual
memory
memory
management
management
with
with
pointers
pointers
like
like
c
c
plus
plus
plus
plus
It's
it's
a
a
pragmatic
pragmatic
language
language
that
that
gives
gives
you
you
safety,
safety
but
but
also
also
the
the
flexibility
flexibility
to
to
be
be
unsafe
unsafe
when
when
needed.
needed
Now
now
the
the
final
final
thing
thing
to
to
know
know
is
is
that
that
currently,
currently
it's
it's
not
not
mobile
mobile
to
to
the
the
public.
public
It's
it's
still
still
in
in
very
very
early
early
development.
development
It
it
will
will
be
be
open
open
sourced
sourced
in
in
the
the
future,
future
but
but
currently
currently
there's
there's
a
a
wait
wait
list
list
to
to
try
try
it
it
out.
out
I
i
was
was
lucky
lucky
enough
enough
to
to
get
get
early
early
access,
access
so
so
let's
let's
fire
fire
To
to
run
run
it,
it
you
you
can
can
create
create
a
a
file
file
ending
ending
in
in
dotmojo
dotmojo
or
or
dot
dot
fire
fire
emoji.
emoji
That's
that's
a
a
huge
huge
advantage
advantage
over
over
Python,
python
which
which
doesn't
doesn't
allow
allow
you
you
to
to
name
name
your
your
files
files
in
in
dot
dot
snake,
snake
but
but
we
we
It
it
can
can
also
also
run
run
the
the
code
code
in
in
a
a
Jupyter
jupyter
notebook,
notebook
where
where
it
it
behaves
behaves
like
like
an
an
interpreted
interpreted
language.
language
Here,
here
we
we
have
have
a
a
matrix
matrix
multiplication
multiplication
demo
demo
that
that
computes
computes
a
a
dot
dot
product
product
to
to
demonstrate
demonstrate
straight
straight
the
the
crazy
crazy
performance
performance
gains
gains
we
we
get
get
with
with
Mojo.
mojo
1st,
1st
it
it
benchmarks
benchmarks
a
a
basic
basic
function
function
in
in
Python,
python
then
then
by
by
simply
simply
importing
importing
that
that
code
code
into
into
Mojo,
mojo
It's
it's
executed
executed
14
14
times
times
faster
faster
with
with
no
no
modifications
modifications
to
to
the
the
code,
code
but
but
we're
we're
only
only
just
just
getting
getting
started.
started
We
we
can
can
further
further
optimize
optimize
this
this
code
code
by
by
adding
adding
types
types
to
to
the
the
Python
python
implementation.
implementation
Mojo
mojo
allows
allows
us
us
to
to
do
do
that
that
with
with
its
its
built
built
in
in
struct
struct
keyword.
keyword
A
a
struct
struct
is
is
very
very
similar
similar
to
to
a
a
Python
python
class,
class
but
but
structs
structs
are
are
static
static
unlike
unlike
classes
classes
which
which
are
are
dynamic.
dynamic
Inside
inside
Side
side
the
the
struct,
struct
we
we
also
also
have
have
keywords
keywords
like
like
var
var
and
and
let,
let
which
which
can
can
define
define
mutable
mutable
and
and
immutable
immutable
variables,
variables
and
and
def
def
is
is
replaced
replaced
with
with
f
f
n,
n
which
which
is
is
a
a
stricter
stricter
your
your
type
type
of
of
function.
function
Also
also
notice
notice
single
single
instruction
instruction
multiple
multiple
data,
data
which
which
is
is
a
a
built
built
in
in
type
type
that
that
represents
represents
a
a
vector
vector
where
where
a
a
single
single
instruction
instruction
can
can
be
be
executed
executed
across
across
multiple
multiple
elements
elements
in
in
parallel
parallel
on
on
the
the
underlying
underlying
line
line
hardware.
hardware
Once
once
we
we
have
have
this
this
struct,
struct
we
we
can
can
then
then
use
use
it
it
as
as
a
a
type
type
in
in
the
the
Python
python
implementation.
implementation
Then
then
when
when
we
we
benchmark
benchmark
the
the
code
code
again,
again
we
we
get
get
a
a
ridiculous
ridiculous
500
500
x
x
performance
performance
boost,
boost
but
but
we're
we're
still
still
not
not
happy
happy
yet.
yet
In
in
the
the
inner
inner
loop,
loop
we
we
can
can
query
query
the
the
vector
vector
width
width
instead
instead
of
of
hard
hard
coding
coding
it,
it
and
and
that
that
gives
gives
us
us
a
a
1,000
1,000
x
x
gain,
gain
but
but
that's
that's
nothing
nothing
compared
compared
to
to
what
what
we're
we're
about
about
to
to
do.
do
Linear
linear
algebra
algebra
is
is
perfect
perfect
for
for
parallel
parallel
computing,
computing
and
and
we
we
can
can
easily
easily
make
make
our
our
code
code
multi
multi
threaded
threaded
with
with
the
the
built
built
in
in
parallelize
parallelize
function,
function
increasing
increasing
our
our
speed
speed
buff
buff
to
to
2,000
2,000
x.
x
But
but
now
now
I've
i've
got
got
a
a
fever,
fever
and
and
the
the
only
only
prescription
prescription
is
is
more
more
performance.
performance
Luckily,
luckily
Mojo
mojo
has
has
built
built
in
in
tiling
tiling
utilities
utilities
that
that
Basically,
basically
allow
allow
us
us
to
to
cache
cache
and
and
reuse
reuse
data
data
more
more
efficiently,
efficiently
and
and
we
we
can
can
even
even
auto
auto
tune
tune
it
it
to
to
find
find
the
the
optimal
optimal
parameters
parameters
for
for
our
our
hardware.
hardware
The
the
end
end
result
result
is
is
over
over
4,000
4,000
times
times
faster
faster
execution
execution
compared
compared
to
to
the
the
original
original
Python
python
code.
code
That's
that's
pretty
pretty
crazy,
crazy
and
and
if
if
you
you
wanna
wanna
see
see
this
this
code
code
broken
broken
down
down
in
in
greater
greater
detail,
detail
I'd
i'd
highly
highly
recommend
recommend
this
this
video
video
from
from
Jeremy
jeremy
Howard.
howard
Mihoward.
mihoward
But
but
I'm
i'm
curious
curious
what
what
you
you
guys
guys
think.
think
Do
do
you
you
really
really
think
think
Mojo
mojo
could
could
kill
kill
Python
python
and
and
c+
c+
at
at
the
the
same
same
time?
time
I'm
i'm
a
a
bit
bit
skeptical,
skeptical
but
but
employers
employers
are
are
already
already
hiring
hiring
Mojo
mojo
developers
developers
with
with
10
10
and
and
years
years
of
of
experience.
experience
This
this
has
has
been
been
the
the
code
code
report.
report
Thanks
thanks
for
for
watching,
watching
and
and
I
i
will
will
see
see
you
you
in
in
the
the
next
next
one.
one
success
The speaker discusses the benefits of Mojo, a new programming language designed for AI hardware, including its ability to scale and optimize Python for AI hardware. The language is compatible with other current programming languages and has built in auto tuning and memory management. It is also designed for mobile-to- public and open source, and is currently in the early development phase. The speaker also discusses the benefits of Mojo, including its ability to run code in multiple streams and efficiently cache and reuse data.
Mojo Lang… a fast futuristic Python alternative
It is May 4, 2023 and you're watching the Code Report. Python is a wonderful language for productive programming, but it has one big problem. It's too slow. And going slow means you'll get made fun of by the Rust and c plus plus chads of the world. But the tables are about to turn thanks to a brand new programming language called Mojo, a superset of Python that's not just 2 times faster, not 10 times faster, but up to 35000 times faster than your Grandpa's Python. And that's a huge deal because Python's the dominant language for artificial intelligence, but behind the curtain, anything that needs to go fast is written in c or c+. Us. In today's video, we'll take Mojo for a spin, but first, here are 5 things that you need to know about it. 1, this is not some random guy's side project on GitHub, but rather it comes from a company founded by Chris Lattner, the guy who created the Swift programming language and the LLVM compiler tool chain. If anybody could fix Python's problems, it's him. And if you have no idea what LLVM is, check out this video. 2, it's a language designed for programming on AI hardware, like GPUs running CUDA and other accelerators. It achieves this by leveraging multi level intermediate representation to scale to exotic hardware types without a ton of complexity. And it even has built in auto tuning to optimize your code for your target hardware. 3, it's designed as a super set of Python, in the same way TypeScript is a superset of JavaScript, so you don't need to learn another language to take advantage of it. And this is unique compared to other modern systems languages like Rust, Zig, NIM, and so on, which would have a higher learning curve for existing Python programmers. It does have a bunch of features on top of Python, on, like, var and let declarations and structs, but the base language is fully compatible with Python. And it can also interop with the Python ecosystem, which means you can still use your favorite libraries like NumPy, Pandas, etcetera. 4, it adds strong type checking to the language. You can still use dynamic types if you prefer, but Static types are essential for optimized performance and error checking. For memory management, it has an ownership system and borrow checker similar to Rust and also supports manual memory management with pointers like c plus plus It's a pragmatic language that gives you safety, but also the flexibility to be unsafe when needed. Now the final thing to know is that currently, it's not mobile to the public. It's still in very early development. It will be open sourced in the future, but currently there's a wait list to try it out. I was lucky enough to get early access, so let's fire To run it, you can create a file ending in dotmojo or dot fire emoji. That's a huge advantage over Python, which doesn't allow you to name your files in dot snake, but we It can also run the code in a Jupyter notebook, where it behaves like an interpreted language. Here, we have a matrix multiplication demo that computes a dot product to demonstrate straight the crazy performance gains we get with Mojo. 1st, it benchmarks a basic function in Python, then by simply importing that code into Mojo, It's executed 14 times faster with no modifications to the code, but we're only just getting started. We can further optimize this code by adding types to the Python implementation. Mojo allows us to do that with its built in struct keyword. A struct is very similar to a Python class, but structs are static unlike classes which are dynamic. Inside Side the struct, we also have keywords like var and let, which can define mutable and immutable variables, and def is replaced with f n, which is a stricter your type of function. Also notice single instruction multiple data, which is a built in type that represents a vector where a single instruction can be executed across multiple elements in parallel on the underlying line hardware. Once we have this struct, we can then use it as a type in the Python implementation. Then when we benchmark the code again, we get a ridiculous 500 x performance boost, but we're still not happy yet. In the inner loop, we can query the vector width instead of hard coding it, and that gives us a 1,000 x gain, but that's nothing compared to what we're about to do. Linear algebra is perfect for parallel computing, and we can easily make our code multi threaded with the built in parallelize function, increasing our speed buff to 2,000 x. But now I've got a fever, and the only prescription is more performance. Luckily, Mojo has built in tiling utilities that Basically, allow us to cache and reuse data more efficiently, and we can even auto tune it to find the optimal parameters for our hardware. The end result is over 4,000 times faster execution compared to the original Python code. That's pretty crazy, and if you wanna see this code broken down in greater detail, I'd highly recommend this video from Jeremy Howard. Mihoward. But I'm curious what you guys think. Do you really think Mojo could kill Python and c+ at the same time? I'm a bit skeptical, but employers are already hiring Mojo developers with 10 and years of experience. This has been the code report. Thanks for watching, and I will see you in the next one.
The speaker discusses the benefits of Mojo, a new programming language designed for AI hardware, including its ability to scale and optimize Python for AI hardware. The language is compatible with other current programming languages and has built in auto tuning and memory management. It is also designed for mobile-to- public and open source, and is currently in the early development phase. The speaker also discusses the benefits of Mojo, including its ability to run code in multiple streams and efficiently cache and reuse data.

        [INST]
        You are youtuber called Fireship you make engaging high-intensity and entertaining coding tutorials and tech news. 
        you covers a wide range of topics relevant to programmers, aiming to help them learn and improve their skills quickly.
        
        Given the title of the video : Mojo Lang… a fast futuristic Python alternative 
        and a small summary : The speaker discusses the benefits of Mojo, a new programming language designed for AI hardware, including its ability to scale and optimize Python for AI hardware. The language is compatible with other current programming languages and has built in auto tuning and memory management. It is also designed for mobile-to- public and open source, and is currently in the early development phase. The speaker also discusses the benefits of Mojo, including its ability to run code in multiple streams and efficiently cache and reuse data.
        [/INST]
        
        Generate the video : It is May 4, 2023 and you're watching the Code Report. Python is a wonderful language for productive programming, but it has one big problem. It's too slow. And going slow means you'll get made fun of by the Rust and c plus plus chads of the world. But the tables are about to turn thanks to a brand new programming language called Mojo, a superset of Python that's not just 2 times faster, not 10 times faster, but up to 35000 times faster than your Grandpa's Python. And that's a huge deal because Python's the dominant language for artificial intelligence, but behind the curtain, anything that needs to go fast is written in c or c+. Us. In today's video, we'll take Mojo for a spin, but first, here are 5 things that you need to know about it. 1, this is not some random guy's side project on GitHub, but rather it comes from a company founded by Chris Lattner, the guy who created the Swift programming language and the LLVM compiler tool chain. If anybody could fix Python's problems, it's him. And if you have no idea what LLVM is, check out this video. 2, it's a language designed for programming on AI hardware, like GPUs running CUDA and other accelerators. It achieves this by leveraging multi level intermediate representation to scale to exotic hardware types without a ton of complexity. And it even has built in auto tuning to optimize your code for your target hardware. 3, it's designed as a super set of Python, in the same way TypeScript is a superset of JavaScript, so you don't need to learn another language to take advantage of it. And this is unique compared to other modern systems languages like Rust, Zig, NIM, and so on, which would have a higher learning curve for existing Python programmers. It does have a bunch of features on top of Python, on, like, var and let declarations and structs, but the base language is fully compatible with Python. And it can also interop with the Python ecosystem, which means you can still use your favorite libraries like NumPy, Pandas, etcetera. 4, it adds strong type checking to the language. You can still use dynamic types if you prefer, but Static types are essential for optimized performance and error checking. For memory management, it has an ownership system and borrow checker similar to Rust and also supports manual memory management with pointers like c plus plus It's a pragmatic language that gives you safety, but also the flexibility to be unsafe when needed. Now the final thing to know is that currently, it's not mobile to the public. It's still in very early development. It will be open sourced in the future, but currently there's a wait list to try it out. I was lucky enough to get early access, so let's fire To run it, you can create a file ending in dotmojo or dot fire emoji. That's a huge advantage over Python, which doesn't allow you to name your files in dot snake, but we It can also run the code in a Jupyter notebook, where it behaves like an interpreted language. Here, we have a matrix multiplication demo that computes a dot product to demonstrate straight the crazy performance gains we get with Mojo. 1st, it benchmarks a basic function in Python, then by simply importing that code into Mojo, It's executed 14 times faster with no modifications to the code, but we're only just getting started. We can further optimize this code by adding types to the Python implementation. Mojo allows us to do that with its built in struct keyword. A struct is very similar to a Python class, but structs are static unlike classes which are dynamic. Inside Side the struct, we also have keywords like var and let, which can define mutable and immutable variables, and def is replaced with f n, which is a stricter your type of function. Also notice single instruction multiple data, which is a built in type that represents a vector where a single instruction can be executed across multiple elements in parallel on the underlying line hardware. Once we have this struct, we can then use it as a type in the Python implementation. Then when we benchmark the code again, we get a ridiculous 500 x performance boost, but we're still not happy yet. In the inner loop, we can query the vector width instead of hard coding it, and that gives us a 1,000 x gain, but that's nothing compared to what we're about to do. Linear algebra is perfect for parallel computing, and we can easily make our code multi threaded with the built in parallelize function, increasing our speed buff to 2,000 x. But now I've got a fever, and the only prescription is more performance. Luckily, Mojo has built in tiling utilities that Basically, allow us to cache and reuse data more efficiently, and we can even auto tune it to find the optimal parameters for our hardware. The end result is over 4,000 times faster execution compared to the original Python code. That's pretty crazy, and if you wanna see this code broken down in greater detail, I'd highly recommend this video from Jeremy Howard. Mihoward. But I'm curious what you guys think. Do you really think Mojo could kill Python and c+ at the same time? I'm a bit skeptical, but employers are already hiring Mojo developers with 10 and years of experience. This has been the code report. Thanks for watching, and I will see you in the next one.
        