Replies: 5 comments
-
Thanks! Issue #334 was opened because we'd noticed a slowdown with the testsuite, but had not identified any single test (or tests) yet. |
Beta Was this translation helpful? Give feedback.
-
It's worth noting that PR #341 made a significant fix to efficiency, so it's worth comparing at or after that merge. Although the fix was not related to large enums, so even with the HEAD I do still see time spent in |
Beta Was this translation helpful? Give feedback.
-
I don't know if anyone has time to look at this, so it may fall me to. But I briefly mentioned it to @krame505 and our instincts are that it has to do with that, for an enum with N tags, there are N nested pattern/constructor applications, each with a type containing up to N One conceivable fix would be to "flatten" the chain of |
Beta Was this translation helpful? Give feedback.
-
A workaround might be to exempt the enum type from the generics mechanism by defining an explicit null instance. For example, the package compiles instantly when I add this (causing BSC not to derive an instance):
However, I don't know if this would cause problems when the type is used in real code (which this file doesn't illustrate). It could cause recursion: when a typeclass is implemented generic-ly, it has a fall-through default that attempts to use the generic-based instance if no concrete instance is found; but if the generic instance finds
The Generic instance is used internally by BSC for implicit condition lifting and per-field handling of undefined and uninitialized values, but since enums do not have subfields, I think it would be OK. In implementing generics, we had discussed having a feature in the syntax for telling BSC that you don't want to auto-derive There are certain expectations on the form of the Generic representation, and I didn't know if, say, the One thing to try might be use
Hm, yes, actually, something like this last one might be best. Here I've declared that the type
it displays the type like this:
You might be able to define the representation with less meta data, such that its representation is just |
Beta Was this translation helpful? Give feedback.
-
The balanced binary tree of |
Beta Was this translation helpful? Give feedback.
-
I observed a regression in bsc, between commits 88d4eef and 67161ca (Merge pull request #284 from krame505/generics)
The behavior is that typecheck is much slower and that Internal hangs as the size of an enum grows.
A reduced test case is attached. This can be run with
bsc -v IPv4.bsv
enums.zip
Beta Was this translation helpful? Give feedback.
All reactions