19

!rant
The more I learn about advanced C++ the more I love this language. C++'s template system is so insanely cool!
Just made a proof of concept expression templates based linear algebra library for my own projects. It was actually a lot of fun to make, and seeing it spit out optimized, loop-fused code with no temporary variables...magic.
Long live C++.

Comments
  • 1
    RT RT RT RT RT RT RT RT RT
  • 2
    You got me curious. Github link?
  • 0
    @TempestasLudi it's too basic to post anywhere right now, so I'm keeping it local. If you're interested, this talk was the inspiration:
    https://youtu.be/IiVl5oSU5B8

    A lot of fast C++ libraries (like the linear algebra library Eigen) use expression templates. Also, the Boost Spirit parser library uses it to make writing grammars a breeze.

    Have a look at Boost Proto if you want to make your own without too much effort.

    You may also want to have a look at template metaprogramming first.
  • 0
    Unbuffered algorithms 4 win.
    BTW did you hear about MATPACK?
    I heard that it is The fastest maths lib that you can get. (its cpu optymalised 😮, and they used heavy assembler optymalisation)
  • 0
    @Gregozor2121 hmm, I'll have to disagree, sometimes buffering can really make your program go faster overall, because it allows you to work with and reason about larger chunks. But yes, lots of tiny buffers are terrible.

    I haven't, I'll have a look, thanks. Eigen and the standard library generally cover my performance needs, and there's always specific libraries like Intel MKL, etc. for extreme cases. Fast math was almost never a problem for me, though.

    Also, I believe the word you're looking for is "optimized" (or optimised). And most of these heavy number crunching libraries have CPU specific optimizations.
  • 0
    I know the difference about buffered and unbuffered appilactions.

    I helped my friend with his project that begged for unbuffered approach.

    In my case my unbuffered algorithm is better because if you process data line by line you wont use any ram at all. Buffered application is slower because it neeeds to load few gb of data into ram... and loading, saving times were terrible in that case.
    Unbuffered app spreads saving, loading operations thats why it dosent saturate hdd io.

    I agree with you but in my case unbuffered is superior :)
  • 0
    Hmm, I don't know what your use case is but that usually leads to absolutely terrible utilisation of resources.
    Sure, loading all the data in the memory is a bad idea, but so is processing it line by line. Load and process data in the biggest chunksize your system can handle (if that's one line, cool).
    Data streaming and reactive programming can really help here.
Add Comment