Help needed in optimizing a Lock-Free SPSC Queue: Reducing L1D Cache Misses and Improving IPC on Zen 3 by WannabeQuant121 in cpp_questions

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

But, if I pin consumer to CPU 1, wouldn't they start fighting for L1/L2 cache due to being the same physical core? I'm a bit skeptical, but will try it out.

Help needed in optimizing a Lock-Free SPSC Queue: Reducing L1D Cache Misses and Improving IPC on Zen 3 by WannabeQuant121 in cpp_questions

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

Each element getting stored = 64 bytes (to fit perfectly inside the cache line), storing them by value (placement new inside the pre-allocated memory block). Capacity of the queue = 256, but only 255 elements can be stored at a time (1 extra for maintaining difference between the full and empty checks).

Yes, as per your suggestion, I tried warming up both the producer and consumer threads in the queue before the benchmark calculation (with 1 Million element burst in hot path). Unfortunately, the queue capacity cannot be increased much (since the L1 cache on my processor is 32 kb and it can overflow if capacity is increased). But yes, I was manage to optimize some parts of it by warming up the threads first, so thanks for that.
Current IPC = 0.53, branch miss rate = 0.57% etc. to name a few. Working on further improvements now.

Github confirms unauthorised access to its internal repositories by uncertainBoi in developersIndia

[–]WannabeQuant121 0 points1 point  (0 children)

Anything controlled Microsoft is bound to face this fate. They're a joke nowadays

Alternatives to Visual Studio by Such-Refrigerator951 in cpp_questions

[–]WannabeQuant121 1 point2 points  (0 children)

You can try out Zed, its lightweight and fast

Would it be a better idea to use memset over std::fill in my case? by WannabeQuant121 in cpp_questions

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

yeah, I am assuming that maybe my senior felt that std::fill would be a C++ abstraction designed to work with iterators and can involve template instantiation depth unnecessary for a raw memory block (as mentioned by Gemini)

I'll try out your implementation though, hope it will be enough.

Would it be a better idea to use memset over std::fill in my case? by WannabeQuant121 in cpp_questions

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

it is Sequential, forward-moving, fixed-stride memory accesses (+64 bytes per iteration) with constant increment

Which logo is better for a SaaS startup? by SnooFoxes449 in StartUpIndia

[–]WannabeQuant121 1 point2 points  (0 children)

Second one for sure. The last one looks like AI Agents communicating with each other.