This project provides a visual representation of performance comparisons between Zig and Rust for specific computational tasks. It uses a game-like interface to illustrate the speed differences, where faster completion of challenges results in the opponent's triangle losing life.
The visualization consists of two triangles facing each other, representing Zig and Rust. As computational tasks are performed, the triangles shoot projectiles at each other. The speed and frequency of these projectiles are determined by the performance of each language for the given task.
- Visual representation of Zig and Rust as triangles
- Performance-based projectile shooting
- Life reduction for slower performance
- Final "explosion" effect for the losing language
- Zig compiler (latest version recommended)
- Rust compiler (for comparison tasks)
- Raylib library
-
Clone the repository:
git clone https://github.com/yourusername/zig-rust-performance-vis.git cd zig-rust-performance-vis
-
Ensure you have Zig and Rust installed on your system.
-
Install Raylib for Zig (instructions may vary based on your system).
To run the Zig visualization:
zig build run
- Start the program to see the initial visualization with two triangles.
- Press the spacebar to initiate a performance comparison task.
- Observe the projectiles being fired based on the speed of computation.
- Watch as the slower-performing language's triangle loses life.
- Continue until one triangle "explodes," indicating a clear performance winner.
To add or modify comparison tasks:
- Create a new Zig file in the
src/tasks/
directory. - Implement the task in both Zig and Rust.
- Add a function in
main.zig
to execute and time the task. - Update the visualization logic to reflect the new task's performance.
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
- Raylib library for graphics
- Zig and Rust communities for their excellent languages and tools
- Add more varied computational tasks
- Implement a user interface for selecting tasks
- Enhance visual effects for better representation of performance differences
- Add support for comparing more programming languages