Giter VIP home page Giter VIP logo

libzahl's Issues

Doesn't Compile with C++ compilers

C++ doesn't support register and restrict.

To fix this we can use macros to only activate these keywordsin C mode and not in C++ mode.

I have a commit ready to fix this. Do you accept pull requests here on github ? Or on suckless.org ?

Branch-less macros?

You may be able (probably unlikely) to sip a little more performance if you replace the logical operator in the following (from libzahl/zahl/inlines.h) with a bitwise operator. If you decide to change zzero(), there are other candidates in inlines.h worth reviewing.

ZAHL_INLINE int zzero(z_t a) { return !a->sign; }

... {return a->sign & 0;}
But, I haven't looked at the assembler code.

Benchmark of libzahl in fractions vs mpdecimal

I wonder how fast would it be to use fractions with high(er) number of places with libzahl as "backend" compared to using plain mpdecimal for precise calculations.

In other words, first find out how to set precision of the fractions to match the precision of mpdecimal and then benchmark some real-world (or at least artifiicial) scenarios for speed.

What would be your guess to be faster?

In the unlikely event that something is likely unlikely.

Can you provide rationale on your choices of likely() and unlikely()?

void
zsub_nonnegative_assign(z_t a, z_t b)
{
if (unlikely(zzero(b)))
zabs(a, a);
else if (unlikely(!zcmpmag(a, b)))
SET_SIGNUM(a, 0);
else
zsub_impl(a, b, b->used);
}

What if I issue zsub_nonnegative_assign(x, "0") in an iterative process? In this example, the unlikely is very, very, very unlikely (zzero(0) is not just likely, but totally likely). (I see that zsub_nonnegative_assign() may be removed.) How do these branch predictions behave if they are more likely to be incorrect than correct for certain use cases? Perhaps you could allow the user of the library a choice on the use of likely()/unlikely().

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.