aboutsummaryrefslogtreecommitdiff
path: root/gen/prop
diff options
context:
space:
mode:
Diffstat (limited to 'gen/prop')
-rwxr-xr-xgen/prop/age4
-rwxr-xr-xgen/prop/bool-props1
-rwxr-xr-xgen/prop/bool-props.py5
-rw-r--r--gen/prop/lib.py13
4 files changed, 20 insertions, 3 deletions
diff --git a/gen/prop/age b/gen/prop/age
index 7105ae1..a565021 100755
--- a/gen/prop/age
+++ b/gen/prop/age
@@ -80,7 +80,7 @@ def main() -> None:
if bs > len(xs):
break
Cs = [tuple(x) for x in chunks(xs, bs)]
- cs = list(dict.fromkeys(Cs))
+ cs = set(Cs)
sz_s1 = len(Cs) * isize(len(cs) - 1)
sz_s2 = len(cs) * bs * 2
@@ -95,5 +95,7 @@ def main() -> None:
sys.stdout = f
genfile(Cs, blksize)
+ report_size(len(xs), smallest)
+
if __name__ == '__main__':
main()
diff --git a/gen/prop/bool-props b/gen/prop/bool-props
index 0a8330f..198b0b8 100755
--- a/gen/prop/bool-props
+++ b/gen/prop/bool-props
@@ -81,7 +81,6 @@ gen()
local p=${1%%=*}
gen/prop/bool-props.py ${1#*=} $p data/$2 \
>lib/unicode/prop/uprop_is_$p.c
- printf 'DONE uprop_is_%s()\n' $p >&2
}
for prop in $props1; do gen $prop PropList & done
diff --git a/gen/prop/bool-props.py b/gen/prop/bool-props.py
index c0f9d05..62cfe74 100755
--- a/gen/prop/bool-props.py
+++ b/gen/prop/bool-props.py
@@ -86,7 +86,7 @@ def main() -> None:
if bs > len(xs):
break
Cs = [tuple(x) for x in chunks(xs, bs)]
- cs = list(dict.fromkeys(Cs))
+ cs = set(Cs)
sz_s1 = len(Cs) * isize(len(cs) - 1)
sz_s2 = len(cs) * bs
@@ -99,5 +99,8 @@ def main() -> None:
Cs = [tuple(x) for x in chunks(xs, blksize)]
genfile(Cs, blksize)
+ sys.argv[0] = sys.argv[2]
+ report_size(len(xs), smallest)
+
if __name__ == '__main__':
main()
diff --git a/gen/prop/lib.py b/gen/prop/lib.py
index e71fcf0..cc0b00a 100644
--- a/gen/prop/lib.py
+++ b/gen/prop/lib.py
@@ -52,3 +52,16 @@ def typename(x: int) -> str:
def cwd_init() -> None:
dir = Path(os.path.dirname(sys.argv[0]))
os.chdir(dir / '..' / '..')
+
+def report_size(before: int, after: int) -> None:
+ def btokib(n: int) -> str:
+ s = str(round(n / 1024, 2))
+ if s.endswith('.0'):
+ s = s[:-2]
+ return s + ' KiB'
+
+ prefix = sys.argv[0].split('/')[-1]
+ change = round((after - before) / before * 100, 1)
+ before = btokib(before)
+ after = btokib(after)
+ print(f'%s\t%s%%\t%s → %s' % (prefix, change, before, after), file=sys.stderr)