hendriknielaender / zBench

📊 zig benchmark
https://hendriknielaender.github.io/zBench/
MIT License
74 stars 10 forks source link

Proposal(Draft): New Folder Structure for zbench #76

Open hendriknielaender opened 6 months ago

hendriknielaender commented 6 months ago

Overview

This proposal outlines a new folder structure for the zbench project to improve modularity and maintainability. Some of the folder structure we already have, other parts are not yet part of the project like formats. It is more of a draft, to keep an eye of the growing codebase.

Proposed Folder Structure

The new folder structure is organized as follows:

/zbench
|-- /lib                     # Source files for the core functionalities
|   |-- /benchmark           # Benchmark related functionalities
|   |   |-- benchmark.zig    # Core benchmark logic
|   |   |-- config.zig       # Benchmark configuration structures
|   |   |-- definition.zig   # Benchmark definition and management
|   |   |-- result.zig       # Result handling and output formats
|   |   |-- statistics.zig   # Statistics calculations
|   |   |-- tracking_allocator.zig
|   |
|   |-- /output             # Different output formats
|   |   |-- json_base.zig    # Base JSON functionality
|   |   |-- bmf.zig          # BMF-specific JSON format
|   |   |-- github.zig       # GitHub Actions-specific JSON format
|   |   |-- custom.zig       # Other custom formats
|   |   |-- color.zig        # Color output control
|   |
|   |-- /util                # Utility functions and helpers
|   |   |-- ...
|   |
|   |-- zbench.zig             # Entry point that ties everything together
|
|-- /docs                    # Documentation for the project
|   |-- intro.md
|   |-- quickstart.md
|   |-- advanced.md
|
|-- /examples                # Examples files
    |-- basic.zig            # Examples for all different use cases
|-- /tests                   # Test files
    |-- benchmark_test.zig   # Tests for benchmarking functionalities

Advantages of the New Structure

FObersteiner commented 6 months ago

I think this is a good idea! Reading the proposed structure, I was wondering what we want do be :) src and main.zig suggests a binary (application) to me - isn't it a library actually?

hendriknielaender commented 6 months ago

Good point, adjusted it to lib and zbench.zig.

FObersteiner commented 6 months ago

since you're at it, I was also wondering if the util directory is needed :) Some ideas:

hendriknielaender commented 6 months ago

True, adjusted to output and moved these files to benchmark. I will also put in all other files into the graph. Currently this was more a basic draft, but with all files mentioned the process will be cleaner.

Merging files i would see in another PR, since this will already be a bigger change.

Ahh for the github actions i meant the output format from an actual benchmark action (see: https://github.com/benchmark-action/github-action-benchmark)