)]}'
{
  "commit": "a6c8e56996c63ce7b0f83c7743a393ecb41c77c6",
  "tree": "e74ca526e93580f7e96cfa2f3c4919a355dc3402",
  "parents": [
    "376c9ce480536ad84572e087e35f31ff931627bc"
  ],
  "author": {
    "name": "Ömer Sinan Ağacan",
    "email": "omersa@google.com",
    "time": "Thu May 15 11:33:46 2025 +0200"
  },
  "committer": {
    "name": "GitHub",
    "email": "noreply@github.com",
    "time": "Thu May 15 10:33:46 2025 +0100"
  },
  "message": "Improve enum decoding -- alternative (#981)\n\nWhen decoding an enum value, we call a callback in the enum field\u0027s `FieldInfo`. The callback then indexes a map mapping enum numbers to Dart values.\n\nWhen these conditions hold:\n\n- The known enum numbers are all positive. (so that we can use a list and index it with the number)\n\n- The known enum numbers are more than 70% of the large known enum number. (so that the list won\u0027t have a lot of `null` entries, wasting heap space)\n\nWe now generate a list instead of a map to map enum numbers to Dart values.\n\nSimilar to the map, the list is runtime allocated. No new code generated per message or enum type.\n\nAOT benchmarks:\n\n- Before: `protobuf_PackedEnumDecoding(RunTimeRaw): 47585.14 us.`\n- After: `protobuf_PackedEnumDecoding(RunTimeRaw): 38974.566666666666 us.`\n- Diff: -18%\n\nWasm benchmarks:\n\n- Before: `protobuf_PackedEnumDecoding(RunTimeRaw): 52225.0 us.`\n- After: `protobuf_PackedEnumDecoding(RunTimeRaw): 34283.33333333333 us.`\n- Diff: -34%\n\n**Alternatives considered:**\n\n- #980 uses a map always, but eliminates the `valueOf` closure.\n- #985 uses a list always, and does binary search in the list when the list is \"shallow\".\n- #987 is the same as #985, but instead of calling the `valueOf` closure it stores an extra field in `FieldInfo`s for whether to binary search or directly index.\n\nThese are all slower than the current PR.",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "b96c119a4e0b804de2a95bb0b81ac47202dd9b38",
      "old_mode": 33188,
      "old_path": "protobuf/lib/src/protobuf/protobuf_enum.dart",
      "new_id": "46c173e33d0b51905820498cc6f873a50d6fa9cf",
      "new_mode": 33188,
      "new_path": "protobuf/lib/src/protobuf/protobuf_enum.dart"
    },
    {
      "type": "modify",
      "old_id": "bab82e37d864611cf317469d86389a1f8d8e1467",
      "old_mode": 33188,
      "old_path": "protoc_plugin/Makefile",
      "new_id": "6c04fa5cc8618c6334cff383b765ad0bce992e90",
      "new_mode": 33188,
      "new_path": "protoc_plugin/Makefile"
    },
    {
      "type": "modify",
      "old_id": "a1cd8b5f7aa26b3a3039e6c7c96fb6e88ddfe89e",
      "old_mode": 33188,
      "old_path": "protoc_plugin/lib/src/enum_generator.dart",
      "new_id": "287a4fe1ebb9da7a80193947850e24c7cabc33f6",
      "new_mode": 33188,
      "new_path": "protoc_plugin/lib/src/enum_generator.dart"
    },
    {
      "type": "modify",
      "old_id": "dc6f349d3b5366ea31ff09145e1a4b664f38e32e",
      "old_mode": 33188,
      "old_path": "protoc_plugin/lib/src/generated/descriptor.pbenum.dart",
      "new_id": "15909ed5a4d69e16a05d4868491044972900d018",
      "new_mode": 33188,
      "new_path": "protoc_plugin/lib/src/generated/descriptor.pbenum.dart"
    },
    {
      "type": "modify",
      "old_id": "399158c55abf1c081fc05ba7d6cf1bfb27a0289c",
      "old_mode": 33188,
      "old_path": "protoc_plugin/lib/src/generated/plugin.pbenum.dart",
      "new_id": "2f427c9f2c94f3ee84f030b89e56bf6d36d74716",
      "new_mode": 33188,
      "new_path": "protoc_plugin/lib/src/generated/plugin.pbenum.dart"
    },
    {
      "type": "modify",
      "old_id": "a25f6a4d438191ffbd314f8425434a3e95a1e5eb",
      "old_mode": 33188,
      "old_path": "protoc_plugin/test/generated_message_test.dart",
      "new_id": "63f8f1e45c3dedeba9e35843614087f98840b734",
      "new_mode": 33188,
      "new_path": "protoc_plugin/test/generated_message_test.dart"
    },
    {
      "type": "modify",
      "old_id": "30bc5d782ba8ccba5e6cf5f8ff22604f781d9d0c",
      "old_mode": 33188,
      "old_path": "protoc_plugin/test/goldens/deprecations.pbenum",
      "new_id": "c21797e773304e466728f9e9eddd82c235cd25bf",
      "new_mode": 33188,
      "new_path": "protoc_plugin/test/goldens/deprecations.pbenum"
    },
    {
      "type": "modify",
      "old_id": "7cde50e139f06bb07c41c739b2989fd7d3a48d20",
      "old_mode": 33188,
      "old_path": "protoc_plugin/test/goldens/doc_comments.pbenum",
      "new_id": "1a35f24182c494da0585bac6cedd84392e008bdc",
      "new_mode": 33188,
      "new_path": "protoc_plugin/test/goldens/doc_comments.pbenum"
    },
    {
      "type": "modify",
      "old_id": "812247ddf671e8d655e9b8ebdc2855d160cc8fd7",
      "old_mode": 33188,
      "old_path": "protoc_plugin/test/goldens/enum",
      "new_id": "2dca720ef8bfc0db9acd90ce698362271e5d870b",
      "new_mode": 33188,
      "new_path": "protoc_plugin/test/goldens/enum"
    },
    {
      "type": "modify",
      "old_id": "3469c7babfe08bb7f5377b7cc602129db31069a8",
      "old_mode": 33188,
      "old_path": "protoc_plugin/test/goldens/messageGeneratorEnums",
      "new_id": "3d673dad43d5d20ca9ae12aecf6066c8c66faf35",
      "new_mode": 33188,
      "new_path": "protoc_plugin/test/goldens/messageGeneratorEnums"
    },
    {
      "type": "modify",
      "old_id": "30d81a24eaa8a345ad5db00a94400297f1475ba8",
      "old_mode": 33188,
      "old_path": "protoc_plugin/test/goldens/topLevelEnum.pbenum",
      "new_id": "69cb70d2870e600bd678ff346b49d544c8f98a33",
      "new_mode": 33188,
      "new_path": "protoc_plugin/test/goldens/topLevelEnum.pbenum"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "03647c9d2c02befe6de7829741cb69dc7fb19c31",
      "new_mode": 33188,
      "new_path": "protoc_plugin/test/protos/enums.proto"
    }
  ]
}
