Skip to content

Fix a bug if two ecinterface.Interfaces are used

Pre-release
Pre-release
Compare
Choose a tag to compare
@kylelemons kylelemons released this 26 Aug 23:12
· 79 commits to master since this release
316e844
Allow changing the implementation of Interface at run-time (#562)

* Allow changing the implementation of Interface at run-time

This is primarily necessary during tests, as most production code won't need to change,
but this is based on an internal detail of atomic.Value, which asserts the underlying
type of the value being Store'd is always identical.  Since it doesn't see Interface,
it only sees interface{} (aka any), it actually cares about the concrete type.

There are various ways we can resolve this, covered in the benchmark,
and with the current compiler using atomic.Value with a concrete struct
type seems to be the winner.  This is faster than the older interface version
because the type assertion to a concrete type is faster than the type assertion
to an interface type.

* Be more cautious about the global load and add a test to ensure it doesn't panic
* Remove the 1.18-only (generic) benchmark since it's not actually _doing_ anything
* it's 1.19