Skip to content
This repository was archived by the owner on Aug 28, 2021. It is now read-only.
This repository was archived by the owner on Aug 28, 2021. It is now read-only.

Replace testify package #83

@cmasone-attic

Description

@cmasone-attic

Summarizing discussion and history:

We use https://github.com/stretchr/testify extensively, both in unit tests and at runtime (for assertions) and have had lots of perf problems with it over the months, mostly due to its use of reflection.

We should just replace this with a simpler version that doesn't use reflection. We don't need that capability, either for our tests or anything else.

In our dbg package, we created a struct that wraps stretchr/testify/assert so we can do things like Chk.Equal() -- analogous to CHECK_EQ() from the Chromium world.

The stretchr stuff is meant to be used in tests, so it's not particularly performant; specifically, the Equal() predicate does reflection to determine if the two things you pass it are comparable. In some of our hot code paths, this adds a lot of runtime -- calling it in ref.Ref.Less() added 15% overhead or so in our initial xml_importer code. It seems to be related not only to the time spent in reflection, but also triggering a fair amount of garbage collection.

We tried creating a Chk.NaiveEqual() predicate that just took whatever you passed it and compared them using !=, but this proved to only save about half the time vs. comparing the values directly and passing the result to Chk.True().

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions