GitHub - vinitkumar/chatbot: A small chatbot experiment built with C and Zig.

A simple keyword-based chatbot with implementations in both C and Zig.

Benchmarks

Build Time & Size

See BENCHMARK.md for detailed build metrics.

Metric C Zig Difference
Build Time 93ms 710ms Zig is 7.63x slower
Executable Size 33K 1.3M Zig is 39x larger

Run build benchmark:

Runtime Performance

Both versions produce identical output. Runtime measurements with test inputs:

Metric C Zig Difference
Execution Time 286ms 526ms C is 1.83x faster

Run runtime benchmark:

Building

C Version

See c/Makefile for more details.

Zig Version

cd zig
zig build-exe src/main.zig -femit-bin=zig-out/bin/chat
./zig-out/bin/chat

Or use the Zig build system:

See zig/README.md for more details.

Testing

C Version

No automated tests (original implementation).

Zig Version

cd zig
zig test src/chatbot.zig

Or: