Benchmarking - Rust vs C++ Part2 [English]

preview_player
Показать описание
Part 2 of speed benchmark between C++ and Rust (+ small dose of reverse engineering)
In the first video (link below) I did basic math benchmark with storing data into standard queue, I got some comments that using queue is not fair. So i decided to do this again with no queue or any special libraries. only pure math (float operations)

Also I will use little reverse engineering with Ghidra framework to look how Clang/GCC optimize the C++ code

Part 1:

Enjoy !
Рекомендации по теме
Комментарии
Автор

If you uses the linux I recommend for little benchmarks use the perf package. You can run 3 time app ang get medium result from tests.

Example uses:
sudo perf stat -B -r NUM_RUNNING PATH_TO_APP

- sudo perf stat -B -r 5 ./test/./app_to_test

exopolity
Автор

Thats a very solid comparison, its a really good quality video

placek
Автор

for ( int i = 0; i < 10; i++ ) { ... only goes to 9 while the rust for goes to 10. ;)

#include <iostream>
#include <cmath>

int main() {
int num = 9;
int upper_bound = std::pow(10, num);

for (int i = 0; i <= upper_bound; i++) {
std::cout << "Iteration " << i << std::endl;
}

return 0;
}

funkyprogrammer
Автор

I would be curious to know which one is faster when you apply the key thing with rust, the memory and lifetime and so on.
How will they compare in that case?

If you can build a kind of large, exact same program in both languages including ownership and lifetimes in rust, that would be awesome to see.
Also, might aswell include c# just to get the difference between the different memory handling methods

MrKristian
Автор

I got one question: Is that Pop!_Os (if so how is you impression, basically you are using it that means you think it is pretty, but why can you make video about pop_os as well)

mrtitanhearted
Автор

rust also has a flag for its compiler to generate fast code ..but you didn't use it !!!!

binlux
Автор

search this in google (rust Optimization: the speed size tradeoff)

binlux