CXXGraph icon indicating copy to clipboard operation
CXXGraph copied to clipboard

Introduce nanobench

Open ZigRazor opened this issue 10 months ago • 8 comments

Introduce nanobench(https://nanobench.ankerl.com/) benchmark tool to better analyze performance

ZigRazor avatar Feb 03 '26 09:02 ZigRazor

What is the issue here actually?

DhruboRoyPartho avatar Feb 03 '26 10:02 DhruboRoyPartho

Is not a problem, it's a request

ZigRazor avatar Feb 03 '26 12:02 ZigRazor

Hey! I’ve been exploring the current benchmark setup and the recently added parallel algorithm implementations before starting the nanobench integration.

My plan is to begin with a smaller subset of algorithms:

  • BFS
  • BellmanFord_parallel
  • FloydWarshall_parallel This is mainly to validate the integration and benchmark structure before expanding coverage further.

A couple of questions before I proceed:

  • I noticed the existing benchmark results currently consist only of single-threaded executions. Considering the newer parallel implementations, is multithreaded benchmarking something you’d want incorporated during the nanobench integration itself?
  • While integrating nanobench, would you prefer that I stay close to the current benchmark structure, or is it fine to introduce additional benchmark cases/parameters where relevant (e.g. thread-count sweeps or parallel vs sequential comparisons)?

I’ll keep the first PR focused and incremental.

Edit - I tried running the existing benchmark setup locally. The README needs to be updated to reflect the current procedure. My laptop (8GB RAM, AMD Ryzen5 6600H) kept freezing every time I ran the included benchmark suite, which uses the CitHepPh.csv with ~34k nodes and ~430k edges. Because of this, I’ll first switch to a smaller dataset to validate the benchmark flow and nanobench integration before scaling back up to the existing dataset. Will update the progress once I have the initial integration working.

skandanyal avatar May 17 '26 16:05 skandanyal

Hi @skandanyal , First of all thank you for your interest. I reply to your questions:

  • I noticed the existing benchmark results currently consist only of single-threaded executions. Considering the newer parallel implementations, is multithreaded benchmarking something you’d want incorporated during the nanobench integration itself?

Yes i want to incorporate a multithreading bechmark

  • While integrating nanobench, would you prefer that I stay close to the current benchmark structure, or is it fine to introduce additional benchmark cases/parameters where relevant (e.g. thread-count sweeps or parallel vs sequential comparisons)?

Additional Benchmark cases/Parameters are welcome

  • I’ll first switch to a smaller dataset to validate the benchmark flow and nanobench integration before scaling back up to the existing dataset

It's ok starting from a smaller datasets

Thank you in advance for your contribution.

ZigRazor avatar May 18 '26 09:05 ZigRazor

im a bit occupied with other work until the EoM. i'll resume working on this pr later. please excuse me.

skandanyal avatar May 24 '26 09:05 skandanyal

ok @skandanyal don't worry!

ZigRazor avatar May 25 '26 07:05 ZigRazor

hey @ZigRazor my uni's semester final exams are going on, hence my progress has been slower than i initially expected.

ive tested the google benchmark harness on BFS on a smaller dataset as shown below, and it seems to be working fine.

> ./benchmark_synth
2026-06-16T00:06:21+05:30
Running ./benchmark_synth
Run on (12 X 1100.33 MHz CPU s)
CPU Caches:
  L1 Data 32 KiB (x6)
  L1 Instruction 32 KiB (x6)
  L2 Unified 512 KiB (x6)
  L3 Unified 16384 KiB (x1)
Load Average: 2.27, 0.98, 0.37
---------------------------------------------------------------------------------
Benchmark                                       Time             CPU   Iterations
---------------------------------------------------------------------------------
BFS_X_alt/1                                   238 ns          238 ns      2928536
BFS_X_alt/2                                   297 ns          297 ns      2356692
BFS_X_alt/4                                   425 ns          425 ns      1647877
BFS_X_alt/8                                   769 ns          769 ns       874446
BFS_X_alt/16                                 1474 ns         1474 ns       474331
BFS_X_alt/32                                 3078 ns         3077 ns       225249
BFS_X_alt/64                                 6617 ns         6614 ns       105507
BFS_X_alt/128                               18206 ns        18197 ns        31766
BFS_X_alt/256                               47639 ns        47620 ns        11310
BFS_X_alt/512                              129953 ns       129907 ns         5344
BFS_X_alt/1024                             314285 ns       314024 ns         2191
BFS_X_alt/2048                             768558 ns       768139 ns          817
BFS_X_alt/4096                            1634508 ns      1633401 ns          432
BFS_X_alt/8192                            4091536 ns      4077648 ns          203
BFS_X_alt/16384                           7122894 ns      7120346 ns           83
BFS_X_alt/32768                          19200755 ns     19191046 ns           36
BFS_X_alt/65536                          44139418 ns     44119127 ns           16
BFS_X_alt/131072                         87082427 ns     87058362 ns            8
BFS_X_alt/262144                        126922353 ns    126867304 ns            5
BFS_X_alt_BigO                             527.87 N        527.66 N    
BFS_X_alt_RMS                                  35 %            35 %    


// below is the print statement used to trace seg faults encountered
synth_graph_ptr: 0x55556b178f70

edge set size: 0[2]    5888 segmentation fault (core dumped)  ./benchmark_synth

i noticed a few commented pre-existing tests which resulted in seg faults. this was discussed in another issue, hence didn't dig deeper into it.

ill keep the work slow until 29th when my exams get over, and ill get two complete months to work on it.

skandanyal avatar Jun 15 '26 18:06 skandanyal

OK @skandanyal Thak you so much in advance

ZigRazor avatar Jun 17 '26 09:06 ZigRazor