dan-fritchman / Hdl21

Hardware Description Library
BSD 3-Clause "New" or "Revised" License
56 stars 10 forks source link

Slightly faster `PortRef` comparisons #228

Open nikosavola opened 2 weeks ago

nikosavola commented 2 weeks ago

Use Python slots for faster lookup and try-except instead of if-else.

I found this to be somewhat faster for exporting Spice. What do you think?

Relates to #227

dan-fritchman commented 2 weeks ago

Surprising!

My guess is the topic referenced in issue #227 (the set/list combo... actually being one) would move the needle much more.

The Set/List combo is "turned off" for reasons I don't entirely remember, but certainly included "caused weird failures I didn't understand elsewhere" in the causal chain.

That reminds me, in any case we've gotta get the tests passing. I think (hope) it's mostly #229 (codecov) in the way. But until that works, who knows. I may be able to get to that late in the week, or you're welcome to roll it in here.

dan-fritchman commented 1 week ago

Now that #230 is done - recommend merging main into here.
That'll give the CI tests a chance of passing.

nikosavola commented 1 week ago

Older Python + Pydantic combinations appear to not automagically handle the slotted class, there might be a manual flag to add in the dataclass decorator I assume.

dan-fritchman commented 4 days ago

Ah.
There is an issue re Python 3.7-8 and Pydantic v2: https://github.com/dan-fritchman/Hdl21/issues/217.
I've written up some thoughts on what we support (and why) there.
It looks like this would brick Pydantic v1 as well, which I'm even more reticent to do.

Did the SetList change not work?
Or not things up as much as you expected, or at this?