Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Build and Test

on:
push:
branches: [ "main" ]
branches: [ "main" , "arm"]
pull_request:
branches: [ "main" ]

Expand Down
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ cmake ..
cmake --build . --config Release
```
## Results

- x64
```bash
Map order book
Latency (cycles)
Expand All @@ -34,3 +34,20 @@ Latency (cycles)
p99: 3520
p99.9: 5640
```

- ARM
```bash
Map order book
Latency (cycles)
p50: 42
p90: 84
p99: 167
p99.9: 1167

Vector order book
Latency (cycles)
p50: 42
p90: 125
p99: 375
p99.9: 625
Comment on lines +41 to +52
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The README still labels these results as "Latency (cycles)", but the code now uses std::chrono::steady_clock nanoseconds (via now_ns()). Please update the unit label (and ideally note the timing source) so the published benchmark numbers are interpretable and comparable.

Copilot uses AI. Check for mistakes.
```
41 changes: 24 additions & 17 deletions include/orderbook/timing.hpp
Original file line number Diff line number Diff line change
@@ -1,21 +1,28 @@
#pragma once
#include <cstdint>
#include <chrono>

#if defined(__x86_64__) || defined(_M_X64)
#ifdef _MSC_VER
#include <intrin.h>
static inline uint64_t rdtsc()
{
return __rdtsc();
inline uint64_t now_ns() {
return std::chrono::duration_cast<std::chrono::nanoseconds>(
std::chrono::steady_clock::now().time_since_epoch()
).count();
}
#else
static inline uint64_t rdtsc()
{
uint32_t lo, hi;
asm volatile("rdtsc" : "=a"(lo), "=d"(hi));
return (static_cast<uint64_t>(hi) << 32) | lo;
}
#endif
#else
#error "rdtsc only supported on x86_64"
#endif

// #if defined(__x86_64__) || defined(_M_X64)
// #ifdef _MSC_VER
// #include <intrin.h>
// static inline uint64_t rdtsc()
// {
// return __rdtsc();
// }
// #else
// static inline uint64_t rdtsc()
// {
// uint32_t lo, hi;
// asm volatile("rdtsc" : "=a"(lo), "=d"(hi));
// return (static_cast<uint64_t>(hi) << 32) | lo;
// }
// #endif
// #else
// #error "rdtsc only supported on x86_64"
// #endif
Comment on lines +10 to +28
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This header leaves the old rdtsc implementation commented out. Keeping large blocks of commented-out code in a public header hurts readability and maintainability. Prefer removing it, or reintroducing it as an active #if/#elif implementation (e.g., use rdtsc on x86_64 and now_ns/ARM counter on other targets).

Suggested change
// #if defined(__x86_64__) || defined(_M_X64)
// #ifdef _MSC_VER
// #include <intrin.h>
// static inline uint64_t rdtsc()
// {
// return __rdtsc();
// }
// #else
// static inline uint64_t rdtsc()
// {
// uint32_t lo, hi;
// asm volatile("rdtsc" : "=a"(lo), "=d"(hi));
// return (static_cast<uint64_t>(hi) << 32) | lo;
// }
// #endif
// #else
// #error "rdtsc only supported on x86_64"
// #endif

Copilot uses AI. Check for mistakes.
4 changes: 2 additions & 2 deletions src/dispatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ void Dispatcher::run(
{
for (const auto &msg : feed.messages())
{
uint64_t start = rdtsc();
uint64_t start = now_ns();

switch (msg.type)
{
Expand All @@ -31,7 +31,7 @@ void Dispatcher::run(
break;
}

uint64_t end = rdtsc();
uint64_t end = now_ns();
recorder.record(end - start);
}
}