Bug 1890540 - Avoid redundant computation of iid_bytes during xpt codegen r=mccr8

Differential Revision: https://phabricator.services.mozilla.com/D207031
This commit is contained in:
serge-sans-paille 2024-04-09 18:05:58 +00:00
parent 278a64c051
commit 9f8eb326af

View File

@ -9,6 +9,7 @@ import json
from collections import OrderedDict
import buildconfig
from mozbuild.util import memoize
from perfecthash import PerfectHash
# Pick a nice power-of-two size for our intermediate PHF tables.
@ -135,6 +136,7 @@ def split_iid(iid): # Get the individual components out of an IID string.
return tuple(split_at_idxs(iid, (8, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2)))
@memoize
def iid_bytes(iid): # Get the byte representation of the IID for hashing.
bs = bytearray()
for num in split_iid(iid):