News for hackers. Stuff that matters.

anon1608

Re:When zero cost abstractions aren't zero cost on Tuesday August 10, 2021 @06:58AM (#28127254)
As always with microbenchmarks...

  struct Error* create_error(const char *msg) {
    struct Error *e = malloc(sizeof(struct Error));
    e->msg = strdup(msg);
    return e;
  }

Is it measuring exceptions vs return codes, or creation cost of std::runtime_error(const char *) (small string opt?) vs malloc() + strdup?