diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/warmup/import/OWNERS.toml b/graalpython/com.oracle.graal.python.benchmarks/python/warmup/import/OWNERS.toml new file mode 100644 index 0000000000..34cb11f338 --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/warmup/import/OWNERS.toml @@ -0,0 +1,6 @@ +[[rule]] +files = "*" +any = [ + "francois.farquet@oracle.com", + "andrija.kolic@oracle.com", +] diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/warmup/import/complex_stdlib_import.py b/graalpython/com.oracle.graal.python.benchmarks/python/warmup/import/complex_stdlib_import.py new file mode 100644 index 0000000000..11e79a3a40 --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/warmup/import/complex_stdlib_import.py @@ -0,0 +1,65 @@ +#!/usr/bin/env python3 +# Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# The Universal Permissive License (UPL), Version 1.0 +# +# Subject to the condition set forth below, permission is hereby granted to any +# person obtaining a copy of this software, associated documentation and/or +# data (collectively the "Software"), free of charge and under any and all +# copyright rights in the Software, and any and all patent rights owned or +# freely licensable by each licensor hereunder covering either (i) the +# unmodified Software as contributed to or provided by such licensor, or (ii) +# the Larger Works (as defined below), to deal in both +# +# (a) the Software, and +# +# (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if +# one is included with the Software each a "Larger Work" to which the Software +# is contributed by such licensors), +# +# without restriction, including without limitation the rights to copy, create +# derivative works of, display, perform, and distribute the Software and make, +# use, sell, offer for sale, import, export, have made, and have sold the +# Software and the Larger Work(s), and to sublicense the foregoing rights on +# either these or other terms. +# +# This license is subject to the following condition: +# +# The above copyright notice and either this complete permission notice or at a +# minimum a reference to the UPL must be included in all copies or substantial +# portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +""" +Benchmark a more complex standard library import. +""" + + +def run(): + import urllib.request + + +# Warmup benchmarks, by definition, are just a single iteration that we measure end-to-end. +# Thus, the following values are fixed and are not tunable. +def warmupIterations(): + return 0 + + +def iterations(): + return 1 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/warmup/import/matplotlib_import.py b/graalpython/com.oracle.graal.python.benchmarks/python/warmup/import/matplotlib_import.py new file mode 100644 index 0000000000..8c540150fe --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/warmup/import/matplotlib_import.py @@ -0,0 +1,66 @@ +#!/usr/bin/env python3 +# Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# The Universal Permissive License (UPL), Version 1.0 +# +# Subject to the condition set forth below, permission is hereby granted to any +# person obtaining a copy of this software, associated documentation and/or +# data (collectively the "Software"), free of charge and under any and all +# copyright rights in the Software, and any and all patent rights owned or +# freely licensable by each licensor hereunder covering either (i) the +# unmodified Software as contributed to or provided by such licensor, or (ii) +# the Larger Works (as defined below), to deal in both +# +# (a) the Software, and +# +# (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if +# one is included with the Software each a "Larger Work" to which the Software +# is contributed by such licensors), +# +# without restriction, including without limitation the rights to copy, create +# derivative works of, display, perform, and distribute the Software and make, +# use, sell, offer for sale, import, export, have made, and have sold the +# Software and the Larger Work(s), and to sublicense the foregoing rights on +# either these or other terms. +# +# This license is subject to the following condition: +# +# The above copyright notice and either this complete permission notice or at a +# minimum a reference to the UPL must be included in all copies or substantial +# portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +""" +Benchmark a more complex third-party import. +""" + + +def run(): + import matplotlib + print(f"Imported {matplotlib.__name__} version '{matplotlib.__version__}'") + + +# Warmup benchmarks, by definition, are just a single iteration that we measure end-to-end. +# Thus, the following values are fixed and are not tunable. +def warmupIterations(): + return 0 + + +def iterations(): + return 1 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/warmup/import/simple_stdlib_import.py b/graalpython/com.oracle.graal.python.benchmarks/python/warmup/import/simple_stdlib_import.py new file mode 100644 index 0000000000..9189f8e023 --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/warmup/import/simple_stdlib_import.py @@ -0,0 +1,65 @@ +#!/usr/bin/env python3 +# Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# The Universal Permissive License (UPL), Version 1.0 +# +# Subject to the condition set forth below, permission is hereby granted to any +# person obtaining a copy of this software, associated documentation and/or +# data (collectively the "Software"), free of charge and under any and all +# copyright rights in the Software, and any and all patent rights owned or +# freely licensable by each licensor hereunder covering either (i) the +# unmodified Software as contributed to or provided by such licensor, or (ii) +# the Larger Works (as defined below), to deal in both +# +# (a) the Software, and +# +# (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if +# one is included with the Software each a "Larger Work" to which the Software +# is contributed by such licensors), +# +# without restriction, including without limitation the rights to copy, create +# derivative works of, display, perform, and distribute the Software and make, +# use, sell, offer for sale, import, export, have made, and have sold the +# Software and the Larger Work(s), and to sublicense the foregoing rights on +# either these or other terms. +# +# This license is subject to the following condition: +# +# The above copyright notice and either this complete permission notice or at a +# minimum a reference to the UPL must be included in all copies or substantial +# portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +""" +Benchmark a simple standard library import. +""" + + +def run(): + import email.utils + + +# Warmup benchmarks, by definition, are just a single iteration that we measure end-to-end. +# Thus, the following values are fixed and are not tunable. +def warmupIterations(): + return 0 + + +def iterations(): + return 1 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } diff --git a/mx.graalpython/polybench-stable-run-config.json b/mx.graalpython/polybench-stable-run-config.json index f7a1ab9c5b..16eb46946d 100644 --- a/mx.graalpython/polybench-stable-run-config.json +++ b/mx.graalpython/polybench-stable-run-config.json @@ -756,5 +756,20 @@ "policy": "outlier-elimination-all-builds", "forks": "5x5", "focus": "0.3-0.7" + }, + "warmup/import/simple_stdlib_import.py": { + "policy": "outlier-elimination-all-builds", + "forks": "4x5", + "focus": "0.0-0.6" + }, + "warmup/import/complex_stdlib_import.py": { + "policy": "outlier-elimination-all-builds", + "forks": "5x5", + "focus": "0.3-0.6" + }, + "warmup/import/matplotlib_import.py": { + "policy": "outlier-elimination-all-builds", + "forks": "4x5", + "focus": "0.0-0.4" } } diff --git a/mx.graalpython/suite.py b/mx.graalpython/suite.py index aaef7e5440..7e7cf540ad 100644 --- a/mx.graalpython/suite.py +++ b/mx.graalpython/suite.py @@ -1655,6 +1655,9 @@ "./warmup/matplotlib/": [ "file:graalpython/com.oracle.graal.python.benchmarks/python/matplotlib/*.py", ], + "./warmup/import/": [ + "file:graalpython/com.oracle.graal.python.benchmarks/python/warmup/import/*.py", + ], }, },