[Git][ghc/ghc][wip/T25046_impl] testsuite: extend size performance tests with gzip (fixes #25046)
Serge S. Gulin (@gulin.serge)
gitlab at gitlab.haskell.org
Fri Aug 2 16:15:11 UTC 2024
Serge S. Gulin pushed to branch wip/T25046_impl at Glasgow Haskell Compiler / GHC
Commits:
73991a7c by Serge S. Gulin at 2024-08-02T19:13:53+03:00
testsuite: extend size performance tests with gzip (fixes #25046)
The main purpose is to create tests for minimal app (hello world and its variations, i.e. unicode used) distribution size metric.
Many platforms support distribution in compressed form via gzip. It would be nice to collect information on how much size is taken by the executional bundle for each platform at minimal edge case.
2 groups of tests are added:
1. We extend javascript backend size tests with gzip-enabled versions for all cases where an optimizing compiler is used (for now it is google closure compiler).
2. We add trivial hello world tests with gzip-enabled versions for all other platforms at CI pipeline where no external optimizing compiler is used.
- - - - -
5 changed files:
- + testsuite/tests/perf/size/Makefile
- testsuite/tests/perf/size/all.T
- testsuite/tests/perf/size/javascript/Makefile
- − testsuite/tests/perf/size/javascript/T24602_perf_size.hs
- testsuite/tests/perf/size/javascript/all.T
Changes:
=====================================
testsuite/tests/perf/size/Makefile
=====================================
@@ -0,0 +1,11 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+size_hello_artifact_gzip:
+ '$(TEST_HC)' $(TEST_HC_OPTS) ./size_hello_artifact.hs -v0 -fforce-recomp
+ gzip --best "./size_hello_artifact$(exe_extension_from_python)"
+
+size_hello_unicode_gzip:
+ '$(TEST_HC)' $(TEST_HC_OPTS) ./size_hello_unicode.hs -v0 -fforce-recomp
+ gzip --best "./size_hello_unicode$(exe_extension_from_python)"
=====================================
testsuite/tests/perf/size/all.T
=====================================
@@ -3,8 +3,24 @@ test('size_hello_obj', [collect_size(5, 'size_hello_obj.o')], compile, [''])
test('size_hello_artifact', [collect_size(5, 'size_hello_artifact' + exe_extension())],
compile_artifact, [''])
+test('size_hello_artifact_gzip', [extra_files(['./size_hello_artifact.hs']),
+ collect_size(5, 'size_hello_artifact' + exe_extension() + '.gz'),
+ # Workaround to run a Makefile test for all platforms (WASM included)
+ # See needsTargetWrapper at testsuite/driver/testlib.py:1433
+ pre_cmd('$MAKE -s --no-print-directory size_hello_artifact_gzip' + ' exe_extension_from_python="' + exe_extension() + '"'), ignore_stdout, ignore_stderr],
+ # We do not need its result for the test but it is required for the workaround to be happen
+ multimod_compile, ['size_hello_artifact', ''])
+
test('size_hello_unicode', [collect_size(5, 'size_hello_unicode' + exe_extension())], compile_artifact, [''])
+test('size_hello_unicode_gzip', [extra_files(['./size_hello_unicode.hs']),
+ collect_size(5, 'size_hello_unicode' + exe_extension() + '.gz'),
+ # Workaround to run a Makefile test for all platforms (WASM included)
+ # See needsTargetWrapper at testsuite/driver/testlib.py:1433
+ pre_cmd('$MAKE -s --no-print-directory size_hello_unicode_gzip' + ' exe_extension_from_python="' + exe_extension() + '"'), ignore_stdout, ignore_stderr],
+ # We do not need its result for the test but it is required for the workaround to be happen
+ multimod_compile, ['size_hello_unicode', ''])
+
size_acceptance_threshold = 100
test('array_dir' ,[collect_size_ghc_pkg(size_acceptance_threshold , 'array')] , static_stats , [] )
=====================================
testsuite/tests/perf/size/javascript/Makefile
=====================================
@@ -3,7 +3,7 @@ include $(TOP)/mk/boilerplate.mk
include $(TOP)/mk/test.mk
T24602_perf_size:
- '$(TEST_HC)' $(TEST_HC_OPTS) ./T24602_perf_size.hs -v0 -fforce-recomp
+ '$(TEST_HC)' $(TEST_HC_OPTS) ./size_hello_artifact.hs -v0 -fforce-recomp
google-closure-compiler \
--platform java \
--warning_level QUIET \
@@ -11,5 +11,23 @@ T24602_perf_size:
--assume_function_wrapper \
--compilation_level ADVANCED_OPTIMIZATIONS \
--emit_use_strict \
- --js_output_file ./T24602_perf_size.jsexe/all.min.js \
- ./T24602_perf_size.jsexe/all.js ./T24602_perf_size.jsexe/all.externs.js
+ --js_output_file ./size_hello_artifact.jsexe/all.min.js \
+ ./size_hello_artifact.jsexe/all.js ./size_hello_artifact.jsexe/all.externs.js
+
+T25046_perf_size_gzip: T24602_perf_size
+ gzip --best ./size_hello_artifact.jsexe/all.min.js
+
+T25046_perf_size_unicode:
+ '$(TEST_HC)' $(TEST_HC_OPTS) ./size_hello_unicode.hs -v0 -fforce-recomp
+ google-closure-compiler \
+ --platform java \
+ --warning_level QUIET \
+ --isolation_mode IIFE \
+ --assume_function_wrapper \
+ --compilation_level ADVANCED_OPTIMIZATIONS \
+ --emit_use_strict \
+ --js_output_file ./size_hello_unicode.jsexe/all.min.js \
+ ./size_hello_unicode.jsexe/all.js ./size_hello_unicode.jsexe/all.externs.js
+
+T25046_perf_size_unicode_gzip: T25046_perf_size_unicode
+ gzip --best ./size_hello_unicode.jsexe/all.min.js
=====================================
testsuite/tests/perf/size/javascript/T24602_perf_size.hs deleted
=====================================
@@ -1,3 +0,0 @@
-module Main where
-
-main = print "Hello, JavaScript!"
=====================================
testsuite/tests/perf/size/javascript/all.T
=====================================
@@ -1,4 +1,7 @@
# These are JavaScript-specific tests based on Google Closure Compiler
setTestOpts(when(not(js_arch()),skip))
-test('T24602_perf_size', [collect_size(5, './T24602_perf_size.jsexe/all.min.js')], makefile_test, ['T24602_perf_size'])
+test('T24602_perf_size', [extra_files(['../size_hello_artifact.hs']), collect_size(5, './size_hello_artifact.jsexe/all.min.js')], makefile_test, ['T24602_perf_size'])
+test('T25046_perf_size_gzip', [extra_files(['../size_hello_artifact.hs']), collect_size(5, './size_hello_artifact.jsexe/all.min.js.gz')], makefile_test, ['T25046_perf_size_gzip'])
+test('T25046_perf_size_unicode', [extra_files(['../size_hello_unicode.hs']), collect_size(5, './size_hello_unicode.jsexe/all.min.js')], makefile_test, ['T25046_perf_size_unicode'])
+test('T25046_perf_size_unicode_gzip', [extra_files(['../size_hello_unicode.hs']), collect_size(5, './size_hello_unicode.jsexe/all.min.js.gz')], makefile_test, ['T25046_perf_size_unicode_gzip'])
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/73991a7caa52ef498a2d318e2b4feec6e6499760
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/73991a7caa52ef498a2d318e2b4feec6e6499760
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20240802/f8fbc447/attachment-0001.html>
More information about the ghc-commits
mailing list