intel / rohd

The Rapid Open Hardware Development (ROHD) framework is a framework for describing and verifying hardware in the Dart programming language.
https://intel.github.io/rohd-website
BSD 3-Clause "New" or "Revised" License
374 stars 67 forks source link

Optimize `Set`s, `Map`s, and `Module.input`/`output` `get`ters #347

Closed mkorbel1 closed 1 year ago

mkorbel1 commented 1 year ago

Description & Motivation

There are a variety of places where ordered Sets and Maps are used when unordered would be fine and offer a slight performance boost that adds up since they are used in fundamental building blocks for designs. Replacing them with unordered versions can give a significiant performance boost.

There are other places where Module.input and Module.output are called during simulation execution. This requires a Map lookup during execution, which is an unnecessary simulation-time performance penalty. Replacing the getters that called input and output with laze initialized variables (late final) removes all of those penalties.

This also removes some inputs from the public API of FlipFlop that shouldn't have ever been there.

Related Issue(s)

N/A

Testing

Existing tests cover it

Backwards-compatibility

Is this a breaking change that will not be backwards-compatible? If yes, how so?

Yes, public getters removed from FlipFlop for clk and d. But nobody should have been using them, so more like a bug fix.

Documentation

Does the change require any updates to documentation? If so, where? Are they included?

No