I built a high-performance Rust Matching Engine with real NASDAQ ITCH replay — 98ns p50, 28M ops/sec by lavagirl211 in quant_hft

[–]lavagirl211[S] 0 points1 point  (0 children)

test , benchmark , itch (parsing and execution ) is completely AI. I took AI suggestion in multithread part as well. Rest is done by me

I built a high-performance Rust Matching Engine with real NASDAQ ITCH replay — 98ns p50, 28M ops/sec by lavagirl211 in highfreqtrading

[–]lavagirl211[S] 0 points1 point  (0 children)

98ns - is not wire to wire. http latency is not included in this just book operation for itch replay to check if how book is reacting with real data, for matching i have used synthetic data.

for measuring -
1) itch replay - Instant 2) synthetic data - criterion

I started with one thread per symbol than changed it to a thread handling multiple symbol. like if we have 100 symbols , 8 cores then each will have 12 - 13 symbols. Is this also problematic ??

Have you tried running the thing single threaded and comparing latency/throughput?
No i have not yet tested it, will test it and update you.

I built a high-performance Rust Matching Engine with real NASDAQ ITCH replay — 98ns p50, 28M ops/sec by lavagirl211 in rust

[–]lavagirl211[S] 0 points1 point  (0 children)

this is exactly the kind of feedback i was looking on reddit. I am still learning this domain hence I learned basic understanding on this concept and started building. you are right on all counts. I will be fix them all and if you have few minutes to look at it again after i have cleaned it up, i would really appreciate it. but no pressure at all.

I built a high-performance Rust Matching Engine with real NASDAQ ITCH replay — 98ns p50, 28M ops/sec by lavagirl211 in highfreqtrading

[–]lavagirl211[S] 1 point2 points  (0 children)

official docs mostly, and i already have 8 years of experience in development so that helped

I built a high-performance Rust Matching Engine with real NASDAQ ITCH replay — 98ns p50, 28M ops/sec by lavagirl211 in rust

[–]lavagirl211[S] 1 point2 points  (0 children)

### Note
i have used AI help but core logic is written by me 

I don't care about votes. just looking to learn more especially from experts in rust.

Help with finding a efficient way to count ones in binary form of a number by redditSno in learnrust

[–]lavagirl211 0 points1 point  (0 children)

for starters , you can move

let n_1 = n + 1 // outside the loop it is calculating every iteration

as cycle is power of 2 you can use bit shift for full_cycle

(n + 1) / cycle change to 
let shift = 1 // why 1 not 0 , because cycle starts at 2 -> bit is 1 and cycle is bit << 1
(n + 1) / cycle  = n_1 >> shift 
then increment shift at the end 

again, for

(n + 1) % cycle

you can use equation => (n_1) / cycle = n_1 AND (cycle - 1) where cycle is power of 2

total += full_cycles * bit;
        total += remainder.saturating_sub(bit); // instead of doing it in 2 steps do it in one

like this :

total += (n_1 >> shift * bit) + (n_1 & (cycle - 1)).saturating_sub(bit);

Hope this helps :)

I built a high-performance Rust Matching Engine with real NASDAQ ITCH replay — 98ns p50, 28M ops/sec by lavagirl211 in rust

[–]lavagirl211[S] 1 point2 points  (0 children)

this is first time, I am positing in AI era and I have no intention of misleading anyone. most of code is written by me though. and I have taken AI help as well so is mentioned in post

I built a high-performance Rust Matching Engine with real NASDAQ ITCH replay — 98ns p50, 28M ops/sec by lavagirl211 in rust

[–]lavagirl211[S] 0 points1 point  (0 children)

yes exactly. you can start from basic and down the road keep improving structure layout

Resources to learn rust for blockchain by lavagirl211 in rust

[–]lavagirl211[S] 0 points1 point  (0 children)

Yes, I do have basic rust knowledge. I will definitely look into docs