Skip to content

Figure out why Brc::new is slower than Arc::new #11

Description

@Techcable

Currently, Brc::new consistently benchmarks as 20-100% slower than Arc::new. While I consider 20% an acceptable slowdown, being 2x as slow as Arc::new is unacceptable.

This has been a problem for a real-world user. A post on reddit by @nynjawitay said

I clone them a bunch, but I call new a LOT in this app. I switched out all the Arcs in this app for Brc and startup went from taking 4 seconds to taking 13 seconds. It's not an open source project or I'd share more.

This is even worse than microbenchmarks would suggest.

I need to figure out why there is a slowdown at all. The only thing we do differently than Arc::new is load a TLS and execute a couple of very rarely taken branches.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions