My first feelings for Rust are love, not fear, so I wanted to start that topic with a different title, and here it is.
I have no question at this moment, so anything Rust love/fear-related is on topic

Redox OS is not Rust on Linux, it is a Nix type OS written in Rust.It does run on Pi's
(at least it runs on my 8GB Pi4 running the 64-bit Raspberry Pi OS).
Like C and C++, Rust does not need any run time libs. Of course there is code to get Rust started, setting up the stack, initialising globals, etc and run main() but no more than C has.
I have to say, that it takes more than a hello, world program to make me "love" a language.
For the UTF-8 checking program compiled on a Raspberry Pi I getHeater wrote: ↑Mon May 29, 2023 9:08 amLike C and C++, Rust does not need any run time libs. Of course there is code to get Rust started, setting up the stack, initialising globals, etc and run main() but no more than C has.
Like C and C++ there is a standard library containing useful things, like the ability to print, access the file system etc. Like C and C++, Rust programs do not need to include the standard library, as for example when building programs for microcontrollers. Rust code can be made as small as C code, it can run on 8 bit AVR microcontrollers for example.
Not sure about D, I understand it uses garbage collection and hence needs an actual run-time to take care of that.
Code: Select all
$ ldd u8scan
linux-vdso.so.1 (0x0000007faf8af000)
libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x0000007faf7d0000)
libc.so.6 => /usr/lib/libc.so.6 (0x0000007faf620000)
/lib/ld-linux-aarch64.so.1 => /usr/lib64/ld-linux-aarch64.so.1 (0x0000007faf872000)
Looks to be closer to 5MB on my Bullseye system ...
Code: Select all
pi@Pi4B:~ $ ls -l /usr/bin/python3.9
-rwxr-xr-x 1 root root 4703672 Mar 12 2021 /usr/bin/python3.9
Interesting, I also see 5MB with ls -l.hippy wrote: ↑Tue May 30, 2023 10:11 pmLooks to be closer to 5MB on my Bullseye system ...Of course we should add in all run-time libraries used by executables in other languages and add in the size of the compilers to have a level playing fieldCode: Select all
pi@Pi4B:~ $ ls -l /usr/bin/python3.9 -rwxr-xr-x 1 root root 4703672 Mar 12 2021 /usr/bin/python3.9
![]()
Code: Select all
$ filefrag -v /usr/bin/python
Filesystem type is: ef53
File size of /usr/bin/python is 23468144 (5730 blocks of 4096 bytes)
ext: logical_offset: physical_offset: length: expected: flags:
0: 0.. 2047: 3180544.. 3182591: 2048:
1: 2048.. 4095: 1726464.. 1728511: 2048: 3182592:
2: 4096.. 5729: 1654784.. 1656417: 1634: 1728512: last,eof
/usr/bin/python: 3 extents found
I don't think the size of the compiler matters. Every time you run a C/D/Fortran/Rust program, the compiler doesn't have to be loaded into memory.
It does if one is comparing an executable which doesn't include a compiler with something like Python which does.
But it can be enough to have one decide to hate a language, or discount it as something that isn't worth the aggravation or perseverance of learning it.
I see it kind of pointless to measure just the executable size and speed. Apart from those two there is a very little reason to use C for anything.jahboater wrote: ↑Tue May 30, 2023 11:05 pmI don't think the size of the compiler matters. Every time you run a C/D/Fortran/Rust program, the compiler doesn't have to be loaded into memory.
But for Python of course, the interpreter must be loaded in memory every time the program runs.
What matters is the size of the executable, and assembler wins.
Well there are other things such as portability, stability/longevity, wide hardware support, wide compiler support, huge number of developers familiar with it, strong ISO standards, proven usage for serious projects (such as OS's etc), mature standard library (that the other languages all seem to use).
I just define it as "what needs to be loaded into memory for the program to run". For C, it is the 6KB executable only (the library functions are only loaded as needed - called lazy loading). For common Python usage, it is the Python interpreter and the Python source file.hippy wrote: ↑Wed May 31, 2023 12:21 pmThe root problem is it's comparing apples with oranges, is using an ill-defined measure of 'executable size'. I would have said the executable size of a Python program would be whatever size '.pyc' file Python would create if instructed to do that, '.mpy' file for MicroPython.
How about looking at the code produced (if efficiency is of interest) ?
Yes, same here.
+1
That is an interesting question. One would normally use Python to execute it, requiring the entire super-sized enchilada, but it would be possible to build a smaller interpreter which only handles the byte codes the '.pyc' uses, and it should be possible to convert that byte code into C or other language and compile that to get an actual native executable.
Possibly. If there really were compelling efficiency gains it might justify more than a cursory assessment, but I don't see that being claimed as a reason to use Rust. None of the potential gains from using Rust seem to outweigh having to learn it for me.
From what I can tell Rust aims to be an improved version of C while C++ aims to be a version of C with more features. The reason this can be possible is that not all features are improvements nor are all improvements features.