Follow

rewrote my C neural network lib in C++, here's some random stats if ur curious!! EXACT same logical basics, C++ is just a lil more OOP of course

C - ~250 LOC
C++ - ~200 LOC

150k iterations avg time:
C - 540ms
C++ - 750ms

1.5m iterations avg time:
C - 3300ms
C++ - 4900ms

· · Web · 3 · 0 · 6

the deeper in both dimensions the network is, the faster that C compares to C++, one test with the structure (2,10,10,10,10,1) approximating XOR:
C++ - avg 9500ms
C - avg 2000ms

almost a 5x speedup for a teeny change! just think that's interesting

@Banshee nothing incredible ahaha, work have given me a day to train in whatever i like - i chose to improve my technical communication so i wanna make an explanitory video on how to make a deep neural net from scratch! i converted my old C project to C++ for simplicity of the video ;u;

@toffy wow I think that's pretty impressive!
I'm a python/matlab boy so C++ and C are insane to me

@Banshee OOOO that's awesome, if you're a python/matlab boy i'm 1000% certain ur math comprehension is better than mine & you'd have an easier time w the source material for this project lmao ;;u;; AND THANK YOUU!

@e @toffy now compare to letting something like Eigen that's using a cache aware algorithm handle the matmul logic for you
@e @toffy although iiuc I guess you have very tiny matrices for this example so it won't matter in that case I guess

@roboneko @e ya matrices are small and but i still use a custom alloc to work in contiguous memory so its cache friendly enough

Sign in to participate in the conversation
RaRuRe

It's pronounced ʁaʁyʁe. And written RaRuRe, or R3 for short.
You can find more infos on this place by clicking there.