HEY GUERILLIANS WELCOME BACK TO GUERILLA TECK WE ARE STARTING A NEW SERIES ON A TRENDING LANGUAGE WHICH IS MOJO LET’S START.
ABOUT MOJO AND ITS FOUNDER
The developer of Swift and the LLVM Compiler Infrastructure, Chris Latner, who also created Mojo Lang, has merged Python's simplicity of use with C's strength. Because of the hardware's exceptional programmability and the models' extensibility, this has enabled a new level of programming for all AI developers.
In terms of speed, Mojo Lang is 35000x quicker than Python, Scalar C++ is 5000x faster, and PyPy is 22x faster.
Mojo Lang and Python are so similar, but there must be some differences, right?
Well, we’ve established that speed is the main difference between the two. But there are a few more.
Adding types
Similar to a Python class, Mojo Lang's built-in struct keyword. Structural differences from dynamical differences between class and struct.var and let are two immutable keywords in the Mojo Lang syntax for instructing. In Mojo Lang, fn, a stricter function, takes the place of def, which defines a function as we are all familiar with from Python.
The built-in type SIMD (Single Instruction Many Data) in Mojo Lang can describe a vector in which a single instruction can be performed over many elements concurrently on the underlying hardware.
You can increase efficiency by 500 times by using the struct type and using it in the Python implementation.
Parallel Computing
Mojo Lang has a built-in parallelization
feature that allows you to split your code into multiple threads, which can
increase speed by 2000 times. Parallel processing is not available in Python
and can be very complex.
Mojo has a built-in tile optimization tool
that allows you to cache and reuse your data more effectively. You can use and
reuse memory that is close together at a given time.
Autotune
With the use of Autotune Mojo Lang, you can automatically modify your program's code to locate the ideal hardware-specific parameters.
CAN WE USE MOJO NOW???
LET’S START WITH SOME CODING PART
And we can import our favorite libraries of Python in Mojo
too and use them similarly to Python.
1) Systems programmers
often want to declare an immutable value.
2) Systems programmers want to get an error if they mistype a variable name in an assignment.
To support this, Mojo supports `let` and `var` declarations, which introduce a new scoped runtime value: `let` is immutable, and `var` is mutable.In many aspects, classes and struct types are comparable. Classes, on the other hand, have dynamic dispatch, monkey-patching (also known as dynamic method "swizzling"), and dynamically bound instance properties, whereas structs are static, bound at compilation time, and embedded within their container rather than inherently indirect and reference counted.