Skip to content

Commit a051ae6

Browse files
committed
[build] simplify makeqstrdata heuristic
The simpler one saves ~150 more bytes per translation.
1 parent a156243 commit a051ae6

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

py/makeqstrdata.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import re
1313
import sys
1414

15-
from math import log
1615
import collections
1716
import gettext
1817
import os.path
@@ -185,7 +184,7 @@ def compute_huffman_coding(translations, compression_filename):
185184
# Score the candidates we found. This is an empirical formula only,
186185
# chosen for its effectiveness.
187186
scores = sorted(
188-
((s, (len(s) - 1) ** log(max(occ - 2, 1)), occ) for (s, occ) in counter.items()),
187+
((s, (len(s) - 1) ** occ, occ) for (s, occ) in counter.items()),
189188
key=lambda x: x[1],
190189
reverse=True,
191190
)

0 commit comments

Comments
 (0)