Skip to content

Commit 79d7ee1

Browse files
authored
Remove gratuitous uses of SplayTreeMap when decoding JSON (#51)
Speed up on CM: ~2x
1 parent f5970b3 commit 79d7ee1

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

lib/json_info_codec.dart

+3-5
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,8 @@ List<String> _toSortedSerializIds(Iterable<Info> infos) =>
1010

1111
// TODO(sigmund): add unit tests.
1212
class JsonToAllInfoConverter extends Converter<Map<String, dynamic>, AllInfo> {
13-
// Using `SplayTreeMap` here because it's faster than the
14-
// default `LinkedHashMap`.
15-
final Map<String, Info> registry =
16-
new SplayTreeMap<String, Info>(compareNatural);
13+
// Using `MashMap` here because it's faster than the default `LinkedHashMap`.
14+
final Map<String, Info> registry = new HashMap<String, Info>();
1715

1816
AllInfo convert(Map<String, dynamic> json) {
1917
registry.clear();
@@ -43,7 +41,7 @@ class JsonToAllInfoConverter extends Converter<Map<String, dynamic>, AllInfo> {
4341
result.constants.addAll(
4442
(elements['constant'] as Map).values.map((c) => parseConstant(c)));
4543

46-
var idMap = new SplayTreeMap<String, Info>(compareNatural);
44+
var idMap = new HashMap<String, Info>();
4745
for (var f in result.functions) {
4846
idMap[f.serializedId] = f;
4947
}

0 commit comments

Comments
 (0)