google / google/json_serializable.dart
enumDecode performance
Open
- Dominant language
- Dart
- Stars
- 1.6k
- Forks
- 461
- Avg merge
- 45m
- Merged PRs (30d)
- 1
Description
I'm noticing json_serializable's `enumDecode` function iterates over the values of a map containing the enum values. Wouldn't it be better to generate a reversed map and use it for this purpose ? It could possibility impact performance over large quantities of data.
Has anyone investigated this performance impact before ?
Relevant code at `enum_helpers.dart` line 76 :
```dart
for (var entry in enumValues.entries) {
if (entry.value == source) {
return entry.key;
}
}
```
Contributor guide
Assessment
This issue has not been assessed yet.