diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/LICENSE.txt b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/LICENSE.txt new file mode 100644 index 0000000000..74b2da5e3f --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/LICENSE.txt @@ -0,0 +1,30 @@ +Copyright (c) 2005-2025, NumPy Developers. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * Neither the name of the NumPy Developers nor the names of any + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/README.md b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/README.md new file mode 100644 index 0000000000..0093444ebd --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/README.md @@ -0,0 +1,155 @@ +# Numpy benchmark port process for benchmarking with the PolyBench harness + +## Brief explanation + +These PolyBench benchmarks have been manually generated for the file `bench_core.py` +that was copied from the `numpy` repository. +Each benchmark file maps 1:1 to a `test_*` method of a `Benchmark` extending class +inside `bench_core.py` and the files are named following the pattern of `--.py` +- e.g. the PolyBench benchmark file `bench_core.Core.time_array_1.py` corresponds to +the `time_array_1` method of the `Core` class which is defined in the `bench_core.py` file. + +If required, the imported set of benchmarks could be expanded to other numpy benchmarks analogously. + +## Version information + +Version: 1.26.4 +Source repository: https://github.com/numpy/numpy + +The version was chosen to align with the one used in `graalpython/mx.graalpython/mx_graalpython_python_benchmarks.py::NumPySuite`. + +## Files sourced from the numpy project + +### bench_core.py +Original file path: numpy/benchmarks/benchmarks/bench_core.py +Changes made to the original file, as reported by the `diff` tool: +``` +1,2c1,2 +< from .common import Benchmark +< +--- +> import sys +> import os +3a4,5 +> sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) +> from common import Benchmark +4a7,8 +> # Ensure we have numpy version info in the logs +> print(f"Using numpy version '{np.__version__}'") +``` + +### common.py +Original file path: numpy/benchmarks/benchmarks/common.py +No modifications made. + +### License.txt +The BSD 3-clause license copied from the numpy repository. + +## Original files necessary for benchmarking with the PolyBench harness + +### `--.py` files +These are new files that do not have a corresponding match in the numpy repository. +They are thus licensed under the Oracle UPL license used elsewhere in this repository. +These files are generated to conform to the expectations of the PolyBench harness. +These files were generated with the help of a generative AI model using the following pattern: +``` +# 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. + +import sys +import os +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) + +LOOP_COUNT = + = None + + +def setup(): + from import + global + = () + .setup() + + +def __benchmark__(): + # Original workload + .() + + +def run(): + for _ in range(LOOP_COUNT): + __benchmark__() + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } + + +def dependencies(): + # Required alongside this file if copied elsewhere + return [".py", "common.py"] + +``` +Where: +* `` is a global variable that stores the instance of the benchmark class. +* `` is the name of the benchmark file (without the extension, e.g. `bench_core`). +* `` is the benchmark class (e.g. `Core`). +* `` is the benchmark method (e.g. `time_array_1`). +* `` is a number tweaked to ensure a workload long enough to minimize noise. +The value was initially set by the AI model and subsequently tweaked by hand. +The value was tweaked so that the benchmark executes somewhere in the range between 10ms and 1s. + +This template is not exhaustive and is provided for the purpose of facilitating maintenance. +There are multiple edge-cases one has to consider when generating a benchmark file: +* The benchmark class might not implement the `setup` method. +* The benchmark method might require arguments to be passed. +In such cases, the values were chosen from the `params` field of the benchmark class and stored +as global constants next to the `LOOP_COUNT` constant. diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_arange_100.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_arange_100.py new file mode 100644 index 0000000000..4e35d7a9df --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_arange_100.py @@ -0,0 +1,83 @@ +# 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. + +import sys +import os +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) + +LOOP_COUNT = 100000 +_core = None + + +def setup(): + from bench_core import Core + global _core + _core = Core() + _core.setup() + + +def __benchmark__(): + # Original workload + _core.time_arange_100() + + +def run(): + for _ in range(LOOP_COUNT): + __benchmark__() + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } + + +def dependencies(): + # Required alongside this file if copied elsewhere + return ["bench_core.py", "common.py"] diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_array_1.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_array_1.py new file mode 100644 index 0000000000..c194635129 --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_array_1.py @@ -0,0 +1,83 @@ +# 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. + +import sys +import os +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) + +LOOP_COUNT = 1_000_000 +_core = None + + +def setup(): + from bench_core import Core + global _core + _core = Core() + _core.setup() + + +def __benchmark__(): + # Original workload + _core.time_array_1() + + +def run(): + for _ in range(LOOP_COUNT): + __benchmark__() + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } + + +def dependencies(): + # Required alongside this file if copied elsewhere + return ["bench_core.py", "common.py"] diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_array_empty.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_array_empty.py new file mode 100644 index 0000000000..d45537b0e7 --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_array_empty.py @@ -0,0 +1,83 @@ +# 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. + +import sys +import os +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) + +LOOP_COUNT = 1_000_000 +_core = None + + +def setup(): + from bench_core import Core + global _core + _core = Core() + _core.setup() + + +def __benchmark__(): + # Original workload + _core.time_array_empty() + + +def run(): + for _ in range(LOOP_COUNT): + __benchmark__() + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } + + +def dependencies(): + # Required alongside this file if copied elsewhere + return ["bench_core.py", "common.py"] diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_array_float64_l1000.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_array_float64_l1000.py new file mode 100644 index 0000000000..921ac4d649 --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_array_float64_l1000.py @@ -0,0 +1,83 @@ +# 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. + +import sys +import os +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) + +LOOP_COUNT = 1000 +_core = None + + +def setup(): + from bench_core import Core + global _core + _core = Core() + _core.setup() + + +def __benchmark__(): + # Original workload + _core.time_array_float64_l1000() + + +def run(): + for _ in range(LOOP_COUNT): + __benchmark__() + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } + + +def dependencies(): + # Required alongside this file if copied elsewhere + return ["bench_core.py", "common.py"] diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_array_float_l1000.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_array_float_l1000.py new file mode 100644 index 0000000000..7156a80e3f --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_array_float_l1000.py @@ -0,0 +1,83 @@ +# 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. + +import sys +import os +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) + +LOOP_COUNT = 1000 +_core = None + + +def setup(): + from bench_core import Core + global _core + _core = Core() + _core.setup() + + +def __benchmark__(): + # Original workload + _core.time_array_float_l1000() + + +def run(): + for _ in range(LOOP_COUNT): + __benchmark__() + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } + + +def dependencies(): + # Required alongside this file if copied elsewhere + return ["bench_core.py", "common.py"] diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_array_float_l1000_dtype.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_array_float_l1000_dtype.py new file mode 100644 index 0000000000..2d6b8b510b --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_array_float_l1000_dtype.py @@ -0,0 +1,83 @@ +# 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. + +import sys +import os +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) + +LOOP_COUNT = 1000 +_core = None + + +def setup(): + from bench_core import Core + global _core + _core = Core() + _core.setup() + + +def __benchmark__(): + # Original workload + _core.time_array_float_l1000_dtype() + + +def run(): + for _ in range(LOOP_COUNT): + __benchmark__() + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } + + +def dependencies(): + # Required alongside this file if copied elsewhere + return ["bench_core.py", "common.py"] diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_array_int_l1000.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_array_int_l1000.py new file mode 100644 index 0000000000..7d1335ea9b --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_array_int_l1000.py @@ -0,0 +1,83 @@ +# 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. + +import sys +import os +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) + +LOOP_COUNT = 1000 +_core = None + + +def setup(): + from bench_core import Core + global _core + _core = Core() + _core.setup() + + +def __benchmark__(): + # Original workload + _core.time_array_int_l1000() + + +def run(): + for _ in range(LOOP_COUNT): + __benchmark__() + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } + + +def dependencies(): + # Required alongside this file if copied elsewhere + return ["bench_core.py", "common.py"] diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_array_l.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_array_l.py new file mode 100644 index 0000000000..038ce95126 --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_array_l.py @@ -0,0 +1,83 @@ +# 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. + +import sys +import os +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) + +LOOP_COUNT = 100000 +_core = None + + +def setup(): + from bench_core import Core + global _core + _core = Core() + _core.setup() + + +def __benchmark__(): + # Original workload + _core.time_array_l() + + +def run(): + for _ in range(LOOP_COUNT): + __benchmark__() + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } + + +def dependencies(): + # Required alongside this file if copied elsewhere + return ["bench_core.py", "common.py"] diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_array_l1.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_array_l1.py new file mode 100644 index 0000000000..7292875851 --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_array_l1.py @@ -0,0 +1,83 @@ +# 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. + +import sys +import os +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) + +LOOP_COUNT = 1000000 +_core = None + + +def setup(): + from bench_core import Core + global _core + _core = Core() + _core.setup() + + +def __benchmark__(): + # Original workload + _core.time_array_l1() + + +def run(): + for _ in range(LOOP_COUNT): + __benchmark__() + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } + + +def dependencies(): + # Required alongside this file if copied elsewhere + return ["bench_core.py", "common.py"] diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_array_l100.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_array_l100.py new file mode 100644 index 0000000000..43c4585ddb --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_array_l100.py @@ -0,0 +1,83 @@ +# 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. + +import sys +import os +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) + +LOOP_COUNT = 10000 +_core = None + + +def setup(): + from bench_core import Core + global _core + _core = Core() + _core.setup() + + +def __benchmark__(): + # Original workload + _core.time_array_l100() + + +def run(): + for _ in range(LOOP_COUNT): + __benchmark__() + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } + + +def dependencies(): + # Required alongside this file if copied elsewhere + return ["bench_core.py", "common.py"] diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_array_l_view.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_array_l_view.py new file mode 100644 index 0000000000..1a75b55ac8 --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_array_l_view.py @@ -0,0 +1,83 @@ +# 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. + +import sys +import os +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) + +LOOP_COUNT = 100000 +_core = None + + +def setup(): + from bench_core import Core + global _core + _core = Core() + _core.setup() + + +def __benchmark__(): + # Original workload + _core.time_array_l_view() + + +def run(): + for _ in range(LOOP_COUNT): + __benchmark__() + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } + + +def dependencies(): + # Required alongside this file if copied elsewhere + return ["bench_core.py", "common.py"] diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_can_cast.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_can_cast.py new file mode 100644 index 0000000000..b50cee1ca1 --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_can_cast.py @@ -0,0 +1,83 @@ +# 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. + +import sys +import os +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) + +LOOP_COUNT = 1000000 +_core = None + + +def setup(): + from bench_core import Core + global _core + _core = Core() + _core.setup() + + +def __benchmark__(): + # Original workload + _core.time_can_cast() + + +def run(): + for _ in range(LOOP_COUNT): + __benchmark__() + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } + + +def dependencies(): + # Required alongside this file if copied elsewhere + return ["bench_core.py", "common.py"] diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_can_cast_same_kind.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_can_cast_same_kind.py new file mode 100644 index 0000000000..ae28277ca6 --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_can_cast_same_kind.py @@ -0,0 +1,83 @@ +# 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. + +import sys +import os +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) + +LOOP_COUNT = 1000000 +_core = None + + +def setup(): + from bench_core import Core + global _core + _core = Core() + _core.setup() + + +def __benchmark__(): + # Original workload + _core.time_can_cast_same_kind() + + +def run(): + for _ in range(LOOP_COUNT): + __benchmark__() + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } + + +def dependencies(): + # Required alongside this file if copied elsewhere + return ["bench_core.py", "common.py"] diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_diag_l100.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_diag_l100.py new file mode 100644 index 0000000000..dde6f3c72c --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_diag_l100.py @@ -0,0 +1,83 @@ +# 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. + +import sys +import os +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) + +LOOP_COUNT = 10000 +_core = None + + +def setup(): + from bench_core import Core + global _core + _core = Core() + _core.setup() + + +def __benchmark__(): + # Original workload + _core.time_diag_l100() + + +def run(): + for _ in range(LOOP_COUNT): + __benchmark__() + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } + + +def dependencies(): + # Required alongside this file if copied elsewhere + return ["bench_core.py", "common.py"] diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_diagflat_l100.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_diagflat_l100.py new file mode 100644 index 0000000000..f7652a760f --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_diagflat_l100.py @@ -0,0 +1,83 @@ +# 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. + +import sys +import os +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) + +LOOP_COUNT = 1000 +_core = None + + +def setup(): + from bench_core import Core + global _core + _core = Core() + _core.setup() + + +def __benchmark__(): + # Original workload + _core.time_diagflat_l100() + + +def run(): + for _ in range(LOOP_COUNT): + __benchmark__() + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } + + +def dependencies(): + # Required alongside this file if copied elsewhere + return ["bench_core.py", "common.py"] diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_diagflat_l50_l50.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_diagflat_l50_l50.py new file mode 100644 index 0000000000..ae08e0539e --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_diagflat_l50_l50.py @@ -0,0 +1,83 @@ +# 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. + +import sys +import os +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) + +LOOP_COUNT = 1000 +_core = None + + +def setup(): + from bench_core import Core + global _core + _core = Core() + _core.setup() + + +def __benchmark__(): + # Original workload + _core.time_diagflat_l50_l50() + + +def run(): + for _ in range(LOOP_COUNT): + __benchmark__() + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } + + +def dependencies(): + # Required alongside this file if copied elsewhere + return ["bench_core.py", "common.py"] diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_dstack_l.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_dstack_l.py new file mode 100644 index 0000000000..3675b67682 --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_dstack_l.py @@ -0,0 +1,83 @@ +# 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. + +import sys +import os +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) + +LOOP_COUNT = 10000 +_core = None + + +def setup(): + from bench_core import Core + global _core + _core = Core() + _core.setup() + + +def __benchmark__(): + # Original workload + _core.time_dstack_l() + + +def run(): + for _ in range(LOOP_COUNT): + __benchmark__() + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } + + +def dependencies(): + # Required alongside this file if copied elsewhere + return ["bench_core.py", "common.py"] diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_empty_100.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_empty_100.py new file mode 100644 index 0000000000..4ebda680df --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_empty_100.py @@ -0,0 +1,83 @@ +# 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. + +import sys +import os +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) + +LOOP_COUNT = 100000 +_core = None + + +def setup(): + from bench_core import Core + global _core + _core = Core() + _core.setup() + + +def __benchmark__(): + # Original workload + _core.time_empty_100() + + +def run(): + for _ in range(LOOP_COUNT): + __benchmark__() + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } + + +def dependencies(): + # Required alongside this file if copied elsewhere + return ["bench_core.py", "common.py"] diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_empty_like.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_empty_like.py new file mode 100644 index 0000000000..48de92709a --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_empty_like.py @@ -0,0 +1,83 @@ +# 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. + +import sys +import os +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) + +LOOP_COUNT = 100000 +_core = None + + +def setup(): + from bench_core import Core + global _core + _core = Core() + _core.setup() + + +def __benchmark__(): + # Original workload + _core.time_empty_like() + + +def run(): + for _ in range(LOOP_COUNT): + __benchmark__() + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } + + +def dependencies(): + # Required alongside this file if copied elsewhere + return ["bench_core.py", "common.py"] diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_eye_100.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_eye_100.py new file mode 100644 index 0000000000..5487c7a40a --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_eye_100.py @@ -0,0 +1,83 @@ +# 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. + +import sys +import os +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) + +LOOP_COUNT = 10000 +_core = None + + +def setup(): + from bench_core import Core + global _core + _core = Core() + _core.setup() + + +def __benchmark__(): + # Original workload + _core.time_eye_100() + + +def run(): + for _ in range(LOOP_COUNT): + __benchmark__() + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } + + +def dependencies(): + # Required alongside this file if copied elsewhere + return ["bench_core.py", "common.py"] diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_eye_3000.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_eye_3000.py new file mode 100644 index 0000000000..2b5448c797 --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_eye_3000.py @@ -0,0 +1,83 @@ +# 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. + +import sys +import os +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) + +LOOP_COUNT = 10 +_core = None + + +def setup(): + from bench_core import Core + global _core + _core = Core() + _core.setup() + + +def __benchmark__(): + # Original workload + _core.time_eye_3000() + + +def run(): + for _ in range(LOOP_COUNT): + __benchmark__() + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } + + +def dependencies(): + # Required alongside this file if copied elsewhere + return ["bench_core.py", "common.py"] diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_hstack_l.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_hstack_l.py new file mode 100644 index 0000000000..45023a6837 --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_hstack_l.py @@ -0,0 +1,83 @@ +# 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. + +import sys +import os +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) + +LOOP_COUNT = 10000 +_core = None + + +def setup(): + from bench_core import Core + global _core + _core = Core() + _core.setup() + + +def __benchmark__(): + # Original workload + _core.time_hstack_l() + + +def run(): + for _ in range(LOOP_COUNT): + __benchmark__() + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } + + +def dependencies(): + # Required alongside this file if copied elsewhere + return ["bench_core.py", "common.py"] diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_identity_100.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_identity_100.py new file mode 100644 index 0000000000..ba1b5d0b99 --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_identity_100.py @@ -0,0 +1,83 @@ +# 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. + +import sys +import os +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) + +LOOP_COUNT = 10000 +_core = None + + +def setup(): + from bench_core import Core + global _core + _core = Core() + _core.setup() + + +def __benchmark__(): + # Original workload + _core.time_identity_100() + + +def run(): + for _ in range(LOOP_COUNT): + __benchmark__() + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } + + +def dependencies(): + # Required alongside this file if copied elsewhere + return ["bench_core.py", "common.py"] diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_identity_3000.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_identity_3000.py new file mode 100644 index 0000000000..55ae152590 --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_identity_3000.py @@ -0,0 +1,83 @@ +# 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. + +import sys +import os +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) + +LOOP_COUNT = 10 +_core = None + + +def setup(): + from bench_core import Core + global _core + _core = Core() + _core.setup() + + +def __benchmark__(): + # Original workload + _core.time_identity_3000() + + +def run(): + for _ in range(LOOP_COUNT): + __benchmark__() + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } + + +def dependencies(): + # Required alongside this file if copied elsewhere + return ["bench_core.py", "common.py"] diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_ones_100.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_ones_100.py new file mode 100644 index 0000000000..b367291978 --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_ones_100.py @@ -0,0 +1,83 @@ +# 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. + +import sys +import os +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) + +LOOP_COUNT = 100000 +_core = None + + +def setup(): + from bench_core import Core + global _core + _core = Core() + _core.setup() + + +def __benchmark__(): + # Original workload + _core.time_ones_100() + + +def run(): + for _ in range(LOOP_COUNT): + __benchmark__() + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } + + +def dependencies(): + # Required alongside this file if copied elsewhere + return ["bench_core.py", "common.py"] diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_tril_indices_500.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_tril_indices_500.py new file mode 100644 index 0000000000..5548196c32 --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_tril_indices_500.py @@ -0,0 +1,83 @@ +# 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. + +import sys +import os +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) + +LOOP_COUNT = 100 +_core = None + + +def setup(): + from bench_core import Core + global _core + _core = Core() + _core.setup() + + +def __benchmark__(): + # Original workload + _core.time_tril_indices_500() + + +def run(): + for _ in range(LOOP_COUNT): + __benchmark__() + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } + + +def dependencies(): + # Required alongside this file if copied elsewhere + return ["bench_core.py", "common.py"] diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_tril_l10x10.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_tril_l10x10.py new file mode 100644 index 0000000000..35efb90e1f --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_tril_l10x10.py @@ -0,0 +1,83 @@ +# 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. + +import sys +import os +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) + +LOOP_COUNT = 10000 +_core = None + + +def setup(): + from bench_core import Core + global _core + _core = Core() + _core.setup() + + +def __benchmark__(): + # Original workload + _core.time_tril_l10x10() + + +def run(): + for _ in range(LOOP_COUNT): + __benchmark__() + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } + + +def dependencies(): + # Required alongside this file if copied elsewhere + return ["bench_core.py", "common.py"] diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_triu_indices_500.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_triu_indices_500.py new file mode 100644 index 0000000000..4cf56bbe5c --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_triu_indices_500.py @@ -0,0 +1,83 @@ +# 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. + +import sys +import os +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) + +LOOP_COUNT = 100 +_core = None + + +def setup(): + from bench_core import Core + global _core + _core = Core() + _core.setup() + + +def __benchmark__(): + # Original workload + _core.time_triu_indices_500() + + +def run(): + for _ in range(LOOP_COUNT): + __benchmark__() + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } + + +def dependencies(): + # Required alongside this file if copied elsewhere + return ["bench_core.py", "common.py"] diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_triu_l10x10.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_triu_l10x10.py new file mode 100644 index 0000000000..9cbc8aa209 --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_triu_l10x10.py @@ -0,0 +1,83 @@ +# 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. + +import sys +import os +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) + +LOOP_COUNT = 10000 +_core = None + + +def setup(): + from bench_core import Core + global _core + _core = Core() + _core.setup() + + +def __benchmark__(): + # Original workload + _core.time_triu_l10x10() + + +def run(): + for _ in range(LOOP_COUNT): + __benchmark__() + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } + + +def dependencies(): + # Required alongside this file if copied elsewhere + return ["bench_core.py", "common.py"] diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_vstack_l.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_vstack_l.py new file mode 100644 index 0000000000..727d612ad1 --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_vstack_l.py @@ -0,0 +1,83 @@ +# 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. + +import sys +import os +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) + +LOOP_COUNT = 10000 +_core = None + + +def setup(): + from bench_core import Core + global _core + _core = Core() + _core.setup() + + +def __benchmark__(): + # Original workload + _core.time_vstack_l() + + +def run(): + for _ in range(LOOP_COUNT): + __benchmark__() + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } + + +def dependencies(): + # Required alongside this file if copied elsewhere + return ["bench_core.py", "common.py"] diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_zeros_100.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_zeros_100.py new file mode 100644 index 0000000000..dc8bdfbcc4 --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_zeros_100.py @@ -0,0 +1,83 @@ +# 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. + +import sys +import os +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) + +LOOP_COUNT = 100000 +_core = None + + +def setup(): + from bench_core import Core + global _core + _core = Core() + _core.setup() + + +def __benchmark__(): + # Original workload + _core.time_zeros_100() + + +def run(): + for _ in range(LOOP_COUNT): + __benchmark__() + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } + + +def dependencies(): + # Required alongside this file if copied elsewhere + return ["bench_core.py", "common.py"] diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.CorrConv.time_convolve.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.CorrConv.time_convolve.py new file mode 100644 index 0000000000..a56bbf974e --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.CorrConv.time_convolve.py @@ -0,0 +1,87 @@ +# 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. + +import sys +import os +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) + +SIZE1 = int(1e5) +SIZE2 = int(1e4) +MODE = 'valid' + +LOOP_COUNT = 1 +_corrconv = None + + +def setup(): + from bench_core import CorrConv + global _corrconv + _corrconv = CorrConv() + _corrconv.setup(SIZE1, SIZE2, MODE) + + +def __benchmark__(): + # Original workload + _corrconv.time_convolve(SIZE1, SIZE2, MODE) + + +def run(): + for _ in range(LOOP_COUNT): + __benchmark__() + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } + + +def dependencies(): + # Required alongside this file if copied elsewhere + return ["bench_core.py", "common.py"] diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.CorrConv.time_correlate.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.CorrConv.time_correlate.py new file mode 100644 index 0000000000..60b76b7d3c --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.CorrConv.time_correlate.py @@ -0,0 +1,87 @@ +# 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. + +import sys +import os +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) + +SIZE1 = int(1e5) +SIZE2 = int(1e4) +MODE = 'valid' + +LOOP_COUNT = 1 +_corrconv = None + + +def setup(): + from bench_core import CorrConv + global _corrconv + _corrconv = CorrConv() + _corrconv.setup(SIZE1, SIZE2, MODE) + + +def __benchmark__(): + # Original workload + _corrconv.time_correlate(SIZE1, SIZE2, MODE) + + +def run(): + for _ in range(LOOP_COUNT): + __benchmark__() + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } + + +def dependencies(): + # Required alongside this file if copied elsewhere + return ["bench_core.py", "common.py"] diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.CountNonzero.time_count_nonzero.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.CountNonzero.time_count_nonzero.py new file mode 100644 index 0000000000..a111364397 --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.CountNonzero.time_count_nonzero.py @@ -0,0 +1,87 @@ +# 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. + +import sys +import os +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) + +NUMAXES = 3 +SIZE = 1_000_000 +DTYPE = bool + +LOOP_COUNT = 1000 +_countnonzero = None + + +def setup(): + from bench_core import CountNonzero + global _countnonzero + _countnonzero = CountNonzero() + _countnonzero.setup(NUMAXES, SIZE, DTYPE) + + +def __benchmark__(): + # Original workload + _countnonzero.time_count_nonzero(NUMAXES, SIZE, DTYPE) + + +def run(): + for _ in range(LOOP_COUNT): + __benchmark__() + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } + + +def dependencies(): + # Required alongside this file if copied elsewhere + return ["bench_core.py", "common.py"] diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.CountNonzero.time_count_nonzero_axis.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.CountNonzero.time_count_nonzero_axis.py new file mode 100644 index 0000000000..a840160d81 --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.CountNonzero.time_count_nonzero_axis.py @@ -0,0 +1,87 @@ +# 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. + +import sys +import os +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) + +NUMAXES = 3 +SIZE = 1_000_000 +DTYPE = bool + +LOOP_COUNT = 10 +_countnonzero = None + + +def setup(): + from bench_core import CountNonzero + global _countnonzero + _countnonzero = CountNonzero() + _countnonzero.setup(NUMAXES, SIZE, DTYPE) + + +def __benchmark__(): + # Original workload + _countnonzero.time_count_nonzero_axis(NUMAXES, SIZE, DTYPE) + + +def run(): + for _ in range(LOOP_COUNT): + __benchmark__() + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } + + +def dependencies(): + # Required alongside this file if copied elsewhere + return ["bench_core.py", "common.py"] diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.CountNonzero.time_count_nonzero_multi_axis.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.CountNonzero.time_count_nonzero_multi_axis.py new file mode 100644 index 0000000000..8b59ef4f42 --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.CountNonzero.time_count_nonzero_multi_axis.py @@ -0,0 +1,87 @@ +# 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. + +import sys +import os +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) + +NUMAXES = 3 +SIZE = 1_000_000 +DTYPE = bool + +LOOP_COUNT = 10 +_countnonzero = None + + +def setup(): + from bench_core import CountNonzero + global _countnonzero + _countnonzero = CountNonzero() + _countnonzero.setup(NUMAXES, SIZE, DTYPE) + + +def __benchmark__(): + # Original workload + _countnonzero.time_count_nonzero_multi_axis(NUMAXES, SIZE, DTYPE) + + +def run(): + for _ in range(LOOP_COUNT): + __benchmark__() + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } + + +def dependencies(): + # Required alongside this file if copied elsewhere + return ["bench_core.py", "common.py"] diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Indices.time_indices.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Indices.time_indices.py new file mode 100644 index 0000000000..d5370a4a4c --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Indices.time_indices.py @@ -0,0 +1,82 @@ +# 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. + +import sys +import os +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) + +LOOP_COUNT = 100 +_indices = None + + +def setup(): + from bench_core import Indices + global _indices + _indices = Indices() + + +def __benchmark__(): + # Original workload + _indices.time_indices() + + +def run(): + for _ in range(LOOP_COUNT): + __benchmark__() + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } + + +def dependencies(): + # Required alongside this file if copied elsewhere + return ["bench_core.py", "common.py"] diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.PackBits.time_packbits.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.PackBits.time_packbits.py new file mode 100644 index 0000000000..197bf75fb3 --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.PackBits.time_packbits.py @@ -0,0 +1,85 @@ +# 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. + +import sys +import os +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) + +DTYPE = bool + +LOOP_COUNT = 100000 +_packbits = None + + +def setup(): + from bench_core import PackBits + global _packbits + _packbits = PackBits() + _packbits.setup(DTYPE) + + +def __benchmark__(): + # Original workload + _packbits.time_packbits(DTYPE) + + +def run(): + for _ in range(LOOP_COUNT): + __benchmark__() + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } + + +def dependencies(): + # Required alongside this file if copied elsewhere + return ["bench_core.py", "common.py"] diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.PackBits.time_packbits_axis0.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.PackBits.time_packbits_axis0.py new file mode 100644 index 0000000000..bf305b0513 --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.PackBits.time_packbits_axis0.py @@ -0,0 +1,85 @@ +# 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. + +import sys +import os +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) + +DTYPE = bool + +LOOP_COUNT = 100 +_packbits = None + + +def setup(): + from bench_core import PackBits + global _packbits + _packbits = PackBits() + _packbits.setup(DTYPE) + + +def __benchmark__(): + # Original workload + _packbits.time_packbits_axis0(DTYPE) + + +def run(): + for _ in range(LOOP_COUNT): + __benchmark__() + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } + + +def dependencies(): + # Required alongside this file if copied elsewhere + return ["bench_core.py", "common.py"] diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.PackBits.time_packbits_axis1.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.PackBits.time_packbits_axis1.py new file mode 100644 index 0000000000..453dc0881b --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.PackBits.time_packbits_axis1.py @@ -0,0 +1,85 @@ +# 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. + +import sys +import os +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) + +DTYPE = bool + +LOOP_COUNT = 10000 +_packbits = None + + +def setup(): + from bench_core import PackBits + global _packbits + _packbits = PackBits() + _packbits.setup(DTYPE) + + +def __benchmark__(): + # Original workload + _packbits.time_packbits_axis1(DTYPE) + + +def run(): + for _ in range(LOOP_COUNT): + __benchmark__() + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } + + +def dependencies(): + # Required alongside this file if copied elsewhere + return ["bench_core.py", "common.py"] diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.PackBits.time_packbits_little.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.PackBits.time_packbits_little.py new file mode 100644 index 0000000000..c160ce0732 --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.PackBits.time_packbits_little.py @@ -0,0 +1,85 @@ +# 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. + +import sys +import os +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) + +DTYPE = bool + +LOOP_COUNT = 100000 +_packbits = None + + +def setup(): + from bench_core import PackBits + global _packbits + _packbits = PackBits() + _packbits.setup(DTYPE) + + +def __benchmark__(): + # Original workload + _packbits.time_packbits_little(DTYPE) + + +def run(): + for _ in range(LOOP_COUNT): + __benchmark__() + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } + + +def dependencies(): + # Required alongside this file if copied elsewhere + return ["bench_core.py", "common.py"] diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.StatsMethods.time_max.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.StatsMethods.time_max.py new file mode 100644 index 0000000000..947977beae --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.StatsMethods.time_max.py @@ -0,0 +1,86 @@ +# 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. + +import sys +import os +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) + +DTYPE = 'float64' +SIZE = 10_000 + +LOOP_COUNT = 10000 +_statsmethods = None + + +def setup(): + from bench_core import StatsMethods + global _statsmethods + _statsmethods = StatsMethods() + _statsmethods.setup(DTYPE, SIZE) + + +def __benchmark__(): + # Original workload + _statsmethods.time_max(DTYPE, SIZE) + + +def run(): + for _ in range(LOOP_COUNT): + __benchmark__() + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } + + +def dependencies(): + # Required alongside this file if copied elsewhere + return ["bench_core.py", "common.py"] diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.StatsMethods.time_mean.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.StatsMethods.time_mean.py new file mode 100644 index 0000000000..b30c1a833c --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.StatsMethods.time_mean.py @@ -0,0 +1,86 @@ +# 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. + +import sys +import os +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) + +DTYPE = 'float64' +SIZE = 10_000 + +LOOP_COUNT = 10000 +_statsmethods = None + + +def setup(): + from bench_core import StatsMethods + global _statsmethods + _statsmethods = StatsMethods() + _statsmethods.setup(DTYPE, SIZE) + + +def __benchmark__(): + # Original workload + _statsmethods.time_mean(DTYPE, SIZE) + + +def run(): + for _ in range(LOOP_COUNT): + __benchmark__() + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } + + +def dependencies(): + # Required alongside this file if copied elsewhere + return ["bench_core.py", "common.py"] diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.StatsMethods.time_min.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.StatsMethods.time_min.py new file mode 100644 index 0000000000..42daeed0ae --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.StatsMethods.time_min.py @@ -0,0 +1,86 @@ +# 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. + +import sys +import os +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) + +DTYPE = 'float64' +SIZE = 10_000 + +LOOP_COUNT = 10000 +_statsmethods = None + + +def setup(): + from bench_core import StatsMethods + global _statsmethods + _statsmethods = StatsMethods() + _statsmethods.setup(DTYPE, SIZE) + + +def __benchmark__(): + # Original workload + _statsmethods.time_min(DTYPE, SIZE) + + +def run(): + for _ in range(LOOP_COUNT): + __benchmark__() + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } + + +def dependencies(): + # Required alongside this file if copied elsewhere + return ["bench_core.py", "common.py"] diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.StatsMethods.time_prod.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.StatsMethods.time_prod.py new file mode 100644 index 0000000000..011bc5df46 --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.StatsMethods.time_prod.py @@ -0,0 +1,86 @@ +# 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. + +import sys +import os +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) + +DTYPE = 'float64' +SIZE = 10_000 + +LOOP_COUNT = 10000 +_statsmethods = None + + +def setup(): + from bench_core import StatsMethods + global _statsmethods + _statsmethods = StatsMethods() + _statsmethods.setup(DTYPE, SIZE) + + +def __benchmark__(): + # Original workload + _statsmethods.time_prod(DTYPE, SIZE) + + +def run(): + for _ in range(LOOP_COUNT): + __benchmark__() + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } + + +def dependencies(): + # Required alongside this file if copied elsewhere + return ["bench_core.py", "common.py"] diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.StatsMethods.time_std.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.StatsMethods.time_std.py new file mode 100644 index 0000000000..12450de327 --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.StatsMethods.time_std.py @@ -0,0 +1,86 @@ +# 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. + +import sys +import os +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) + +DTYPE = 'float64' +SIZE = 10_000 + +LOOP_COUNT = 1000 +_statsmethods = None + + +def setup(): + from bench_core import StatsMethods + global _statsmethods + _statsmethods = StatsMethods() + _statsmethods.setup(DTYPE, SIZE) + + +def __benchmark__(): + # Original workload + _statsmethods.time_std(DTYPE, SIZE) + + +def run(): + for _ in range(LOOP_COUNT): + __benchmark__() + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } + + +def dependencies(): + # Required alongside this file if copied elsewhere + return ["bench_core.py", "common.py"] diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.StatsMethods.time_sum.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.StatsMethods.time_sum.py new file mode 100644 index 0000000000..fc6545ee66 --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.StatsMethods.time_sum.py @@ -0,0 +1,86 @@ +# 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. + +import sys +import os +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) + +DTYPE = 'float64' +SIZE = 10_000 + +LOOP_COUNT = 10000 +_statsmethods = None + + +def setup(): + from bench_core import StatsMethods + global _statsmethods + _statsmethods = StatsMethods() + _statsmethods.setup(DTYPE, SIZE) + + +def __benchmark__(): + # Original workload + _statsmethods.time_sum(DTYPE, SIZE) + + +def run(): + for _ in range(LOOP_COUNT): + __benchmark__() + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } + + +def dependencies(): + # Required alongside this file if copied elsewhere + return ["bench_core.py", "common.py"] diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.StatsMethods.time_var.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.StatsMethods.time_var.py new file mode 100644 index 0000000000..bfc58877c1 --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.StatsMethods.time_var.py @@ -0,0 +1,86 @@ +# 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. + +import sys +import os +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) + +DTYPE = 'float64' +SIZE = 10_000 + +LOOP_COUNT = 1000 +_statsmethods = None + + +def setup(): + from bench_core import StatsMethods + global _statsmethods + _statsmethods = StatsMethods() + _statsmethods.setup(DTYPE, SIZE) + + +def __benchmark__(): + # Original workload + _statsmethods.time_var(DTYPE, SIZE) + + +def run(): + for _ in range(LOOP_COUNT): + __benchmark__() + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } + + +def dependencies(): + # Required alongside this file if copied elsewhere + return ["bench_core.py", "common.py"] diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Temporaries.time_large.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Temporaries.time_large.py new file mode 100644 index 0000000000..c2e3d74a52 --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Temporaries.time_large.py @@ -0,0 +1,83 @@ +# 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. + +import sys +import os +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) + +LOOP_COUNT = 100 +_temporaries = None + + +def setup(): + from bench_core import Temporaries + global _temporaries + _temporaries = Temporaries() + _temporaries.setup() + + +def __benchmark__(): + # Original workload + _temporaries.time_large() + + +def run(): + for _ in range(LOOP_COUNT): + __benchmark__() + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } + + +def dependencies(): + # Required alongside this file if copied elsewhere + return ["bench_core.py", "common.py"] diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Temporaries.time_large2.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Temporaries.time_large2.py new file mode 100644 index 0000000000..9d99e33dd2 --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Temporaries.time_large2.py @@ -0,0 +1,83 @@ +# 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. + +import sys +import os +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) + +LOOP_COUNT = 100 +_temporaries = None + + +def setup(): + from bench_core import Temporaries + global _temporaries + _temporaries = Temporaries() + _temporaries.setup() + + +def __benchmark__(): + # Original workload + _temporaries.time_large2() + + +def run(): + for _ in range(LOOP_COUNT): + __benchmark__() + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } + + +def dependencies(): + # Required alongside this file if copied elsewhere + return ["bench_core.py", "common.py"] diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Temporaries.time_mid.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Temporaries.time_mid.py new file mode 100644 index 0000000000..85db0ac146 --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Temporaries.time_mid.py @@ -0,0 +1,83 @@ +# 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. + +import sys +import os +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) + +LOOP_COUNT = 1000 +_temporaries = None + + +def setup(): + from bench_core import Temporaries + global _temporaries + _temporaries = Temporaries() + _temporaries.setup() + + +def __benchmark__(): + # Original workload + _temporaries.time_mid() + + +def run(): + for _ in range(LOOP_COUNT): + __benchmark__() + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } + + +def dependencies(): + # Required alongside this file if copied elsewhere + return ["bench_core.py", "common.py"] diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Temporaries.time_mid2.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Temporaries.time_mid2.py new file mode 100644 index 0000000000..856841e42b --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Temporaries.time_mid2.py @@ -0,0 +1,83 @@ +# 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. + +import sys +import os +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) + +LOOP_COUNT = 1000 +_temporaries = None + + +def setup(): + from bench_core import Temporaries + global _temporaries + _temporaries = Temporaries() + _temporaries.setup() + + +def __benchmark__(): + # Original workload + _temporaries.time_mid2() + + +def run(): + for _ in range(LOOP_COUNT): + __benchmark__() + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } + + +def dependencies(): + # Required alongside this file if copied elsewhere + return ["bench_core.py", "common.py"] diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.UnpackBits.time_unpackbits.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.UnpackBits.time_unpackbits.py new file mode 100644 index 0000000000..e11c15e7fe --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.UnpackBits.time_unpackbits.py @@ -0,0 +1,83 @@ +# 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. + +import sys +import os +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) + +LOOP_COUNT = 10000 +_unpackbits = None + + +def setup(): + from bench_core import UnpackBits + global _unpackbits + _unpackbits = UnpackBits() + _unpackbits.setup() + + +def __benchmark__(): + # Original workload + _unpackbits.time_unpackbits() + + +def run(): + for _ in range(LOOP_COUNT): + __benchmark__() + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } + + +def dependencies(): + # Required alongside this file if copied elsewhere + return ["bench_core.py", "common.py"] diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.UnpackBits.time_unpackbits_axis0.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.UnpackBits.time_unpackbits_axis0.py new file mode 100644 index 0000000000..0c21e6356b --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.UnpackBits.time_unpackbits_axis0.py @@ -0,0 +1,83 @@ +# 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. + +import sys +import os +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) + +LOOP_COUNT = 100 +_unpackbits = None + + +def setup(): + from bench_core import UnpackBits + global _unpackbits + _unpackbits = UnpackBits() + _unpackbits.setup() + + +def __benchmark__(): + # Original workload + _unpackbits.time_unpackbits_axis0() + + +def run(): + for _ in range(LOOP_COUNT): + __benchmark__() + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } + + +def dependencies(): + # Required alongside this file if copied elsewhere + return ["bench_core.py", "common.py"] diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.UnpackBits.time_unpackbits_axis1.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.UnpackBits.time_unpackbits_axis1.py new file mode 100644 index 0000000000..a244c4738e --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.UnpackBits.time_unpackbits_axis1.py @@ -0,0 +1,83 @@ +# 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. + +import sys +import os +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) + +LOOP_COUNT = 1000 +_unpackbits = None + + +def setup(): + from bench_core import UnpackBits + global _unpackbits + _unpackbits = UnpackBits() + _unpackbits.setup() + + +def __benchmark__(): + # Original workload + _unpackbits.time_unpackbits_axis1() + + +def run(): + for _ in range(LOOP_COUNT): + __benchmark__() + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } + + +def dependencies(): + # Required alongside this file if copied elsewhere + return ["bench_core.py", "common.py"] diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.UnpackBits.time_unpackbits_axis1_little.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.UnpackBits.time_unpackbits_axis1_little.py new file mode 100644 index 0000000000..953a8c1862 --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.UnpackBits.time_unpackbits_axis1_little.py @@ -0,0 +1,83 @@ +# 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. + +import sys +import os +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) + +LOOP_COUNT = 1000 +_unpackbits = None + + +def setup(): + from bench_core import UnpackBits + global _unpackbits + _unpackbits = UnpackBits() + _unpackbits.setup() + + +def __benchmark__(): + # Original workload + _unpackbits.time_unpackbits_axis1_little() + + +def run(): + for _ in range(LOOP_COUNT): + __benchmark__() + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } + + +def dependencies(): + # Required alongside this file if copied elsewhere + return ["bench_core.py", "common.py"] diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.UnpackBits.time_unpackbits_little.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.UnpackBits.time_unpackbits_little.py new file mode 100644 index 0000000000..022ff52aa0 --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.UnpackBits.time_unpackbits_little.py @@ -0,0 +1,83 @@ +# 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. + +import sys +import os +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) + +LOOP_COUNT = 10000 +_unpackbits = None + + +def setup(): + from bench_core import UnpackBits + global _unpackbits + _unpackbits = UnpackBits() + _unpackbits.setup() + + +def __benchmark__(): + # Original workload + _unpackbits.time_unpackbits_little() + + +def run(): + for _ in range(LOOP_COUNT): + __benchmark__() + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } + + +def dependencies(): + # Required alongside this file if copied elsewhere + return ["bench_core.py", "common.py"] diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.py new file mode 100644 index 0000000000..326f1e3ce9 --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.py @@ -0,0 +1,259 @@ +import sys +import os +import numpy as np +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) +from common import Benchmark + +# Ensure we have numpy version info in the logs +print(f"Using numpy version '{np.__version__}'") + +class Core(Benchmark): + def setup(self): + self.l100 = range(100) + self.l50 = range(50) + self.float_l1000 = [float(i) for i in range(1000)] + self.float64_l1000 = [np.float64(i) for i in range(1000)] + self.int_l1000 = list(range(1000)) + self.l = [np.arange(1000), np.arange(1000)] + self.l_view = [memoryview(a) for a in self.l] + self.l10x10 = np.ones((10, 10)) + self.float64_dtype = np.dtype(np.float64) + + def time_array_1(self): + np.array(1) + + def time_array_empty(self): + np.array([]) + + def time_array_l1(self): + np.array([1]) + + def time_array_l100(self): + np.array(self.l100) + + def time_array_float_l1000(self): + np.array(self.float_l1000) + + def time_array_float_l1000_dtype(self): + np.array(self.float_l1000, dtype=self.float64_dtype) + + def time_array_float64_l1000(self): + np.array(self.float64_l1000) + + def time_array_int_l1000(self): + np.array(self.int_l1000) + + def time_array_l(self): + np.array(self.l) + + def time_array_l_view(self): + np.array(self.l_view) + + def time_can_cast(self): + np.can_cast(self.l10x10, self.float64_dtype) + + def time_can_cast_same_kind(self): + np.can_cast(self.l10x10, self.float64_dtype, casting="same_kind") + + def time_vstack_l(self): + np.vstack(self.l) + + def time_hstack_l(self): + np.hstack(self.l) + + def time_dstack_l(self): + np.dstack(self.l) + + def time_arange_100(self): + np.arange(100) + + def time_zeros_100(self): + np.zeros(100) + + def time_ones_100(self): + np.ones(100) + + def time_empty_100(self): + np.empty(100) + + def time_empty_like(self): + np.empty_like(self.l10x10) + + def time_eye_100(self): + np.eye(100) + + def time_identity_100(self): + np.identity(100) + + def time_eye_3000(self): + np.eye(3000) + + def time_identity_3000(self): + np.identity(3000) + + def time_diag_l100(self): + np.diag(self.l100) + + def time_diagflat_l100(self): + np.diagflat(self.l100) + + def time_diagflat_l50_l50(self): + np.diagflat([self.l50, self.l50]) + + def time_triu_l10x10(self): + np.triu(self.l10x10) + + def time_tril_l10x10(self): + np.tril(self.l10x10) + + def time_triu_indices_500(self): + np.triu_indices(500) + + def time_tril_indices_500(self): + np.tril_indices(500) + + +class Temporaries(Benchmark): + def setup(self): + self.amid = np.ones(50000) + self.bmid = np.ones(50000) + self.alarge = np.ones(1000000) + self.blarge = np.ones(1000000) + + def time_mid(self): + (self.amid * 2) + self.bmid + + def time_mid2(self): + (self.amid + self.bmid) - 2 + + def time_large(self): + (self.alarge * 2) + self.blarge + + def time_large2(self): + (self.alarge + self.blarge) - 2 + + +class CorrConv(Benchmark): + params = [[50, 1000, int(1e5)], + [10, 100, 1000, int(1e4)], + ['valid', 'same', 'full']] + param_names = ['size1', 'size2', 'mode'] + + def setup(self, size1, size2, mode): + self.x1 = np.linspace(0, 1, num=size1) + self.x2 = np.cos(np.linspace(0, 2*np.pi, num=size2)) + + def time_correlate(self, size1, size2, mode): + np.correlate(self.x1, self.x2, mode=mode) + + def time_convolve(self, size1, size2, mode): + np.convolve(self.x1, self.x2, mode=mode) + + +class CountNonzero(Benchmark): + param_names = ['numaxes', 'size', 'dtype'] + params = [ + [1, 2, 3], + [100, 10000, 1000000], + [bool, np.int8, np.int16, np.int32, np.int64, str, object] + ] + + def setup(self, numaxes, size, dtype): + self.x = np.arange(numaxes * size).reshape(numaxes, size) + self.x = (self.x % 3).astype(dtype) + + def time_count_nonzero(self, numaxes, size, dtype): + np.count_nonzero(self.x) + + def time_count_nonzero_axis(self, numaxes, size, dtype): + np.count_nonzero(self.x, axis=self.x.ndim - 1) + + def time_count_nonzero_multi_axis(self, numaxes, size, dtype): + if self.x.ndim >= 2: + np.count_nonzero(self.x, axis=( + self.x.ndim - 1, self.x.ndim - 2)) + + +class PackBits(Benchmark): + param_names = ['dtype'] + params = [[bool, np.uintp]] + def setup(self, dtype): + self.d = np.ones(10000, dtype=dtype) + self.d2 = np.ones((200, 1000), dtype=dtype) + + def time_packbits(self, dtype): + np.packbits(self.d) + + def time_packbits_little(self, dtype): + np.packbits(self.d, bitorder="little") + + def time_packbits_axis0(self, dtype): + np.packbits(self.d2, axis=0) + + def time_packbits_axis1(self, dtype): + np.packbits(self.d2, axis=1) + + +class UnpackBits(Benchmark): + def setup(self): + self.d = np.ones(10000, dtype=np.uint8) + self.d2 = np.ones((200, 1000), dtype=np.uint8) + + def time_unpackbits(self): + np.unpackbits(self.d) + + def time_unpackbits_little(self): + np.unpackbits(self.d, bitorder="little") + + def time_unpackbits_axis0(self): + np.unpackbits(self.d2, axis=0) + + def time_unpackbits_axis1(self): + np.unpackbits(self.d2, axis=1) + + def time_unpackbits_axis1_little(self): + np.unpackbits(self.d2, bitorder="little", axis=1) + + +class Indices(Benchmark): + def time_indices(self): + np.indices((1000, 500)) + + +class StatsMethods(Benchmark): + # Not testing, but in array_api (redundant) + # 8, 16, 32 bit variants, and 128 complexes + params = [['int64', 'uint64', 'float64', 'intp', + 'complex64', 'bool', 'float', 'int', + 'complex', 'complex256'], + [100**n for n in range(0, 2)]] + param_names = ['dtype', 'size'] + + def setup(self, dtype, size): + try: + self.data = np.ones(size, dtype=getattr(np, dtype)) + except AttributeError: # builtins throw AttributeError after 1.20 + self.data = np.ones(size, dtype=dtype) + if dtype.startswith('complex'): + self.data = np.random.randn(size) + 1j * np.random.randn(size) + + def time_min(self, dtype, size): + self.data.min() + + def time_max(self, dtype, size): + self.data.max() + + def time_mean(self, dtype, size): + self.data.mean() + + def time_std(self, dtype, size): + self.data.std() + + def time_prod(self, dtype, size): + self.data.prod() + + def time_var(self, dtype, size): + self.data.var() + + def time_sum(self, dtype, size): + self.data.sum() diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/common.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/common.py new file mode 100644 index 0000000000..4f291dad11 --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/common.py @@ -0,0 +1,224 @@ +import numpy as np +import random +import os +from functools import lru_cache +from pathlib import Path + +# Various pre-crafted datasets/variables for testing +# !!! Must not be changed -- only appended !!! +# while testing numpy we better not rely on numpy to produce random +# sequences +random.seed(1) +# but will seed it nevertheless +np.random.seed(1) + +nx, ny = 1000, 1000 +# reduced squares based on indexes_rand, primarily for testing more +# time-consuming functions (ufunc, linalg, etc) +nxs, nys = 100, 100 + +# a list of interesting types to test +TYPES1 = [ + 'int16', 'float16', + 'int32', 'float32', + 'int64', 'float64', 'complex64', + 'longdouble', 'complex128', +] +if 'complex256' in np.sctypeDict: + TYPES1.append('clongdouble') + +DLPACK_TYPES = [ + 'int16', 'float16', + 'int32', 'float32', + 'int64', 'float64', 'complex64', + 'complex128', 'bool', +] + +# Path for caching +CACHE_ROOT = Path(__file__).resolve().parent.parent / 'env' / 'numpy_benchdata' + +# values which will be used to construct our sample data matrices +# replicate 10 times to speed up initial imports of this helper +# and generate some redundancy + +@lru_cache(typed=True) +def get_values(): + rnd = np.random.RandomState(1) + values = np.tile(rnd.uniform(0, 100, size=nx*ny//10), 10) + return values + + +@lru_cache(typed=True) +def get_square(dtype): + values = get_values() + arr = values.astype(dtype=dtype).reshape((nx, ny)) + + # adjust complex ones to have non-degenerated imagery part -- use + # original data transposed for that + if arr.dtype.kind == 'c': + arr += arr.T*1j + + return arr + +@lru_cache(typed=True) +def get_squares(): + return {t: get_square(t) for t in TYPES1} + + +@lru_cache(typed=True) +def get_square_(dtype): + arr = get_square(dtype) + return arr[:nxs, :nys] + + +@lru_cache(typed=True) +def get_squares_(): + # smaller squares + return {t: get_square_(t) for t in TYPES1} + + +@lru_cache(typed=True) +def get_vectors(): + # vectors + vectors = {t: s[0] for t, s in get_squares().items()} + return vectors + + +@lru_cache(typed=True) +def get_indexes(): + indexes = list(range(nx)) + # so we do not have all items + indexes.pop(5) + indexes.pop(95) + + indexes = np.array(indexes) + return indexes + + +@lru_cache(typed=True) +def get_indexes_rand(): + rnd = random.Random(1) + + indexes_rand = get_indexes().tolist() # copy + rnd.shuffle(indexes_rand) # in-place shuffle + indexes_rand = np.array(indexes_rand) + return indexes_rand + + +@lru_cache(typed=True) +def get_indexes_(): + # smaller versions + indexes = get_indexes() + indexes_ = indexes[indexes < nxs] + return indexes_ + + +@lru_cache(typed=True) +def get_indexes_rand_(): + indexes_rand = get_indexes_rand() + indexes_rand_ = indexes_rand[indexes_rand < nxs] + return indexes_rand_ + + +@lru_cache(typed=True) +def get_data(size, dtype, ip_num=0, zeros=False, finite=True, denormal=False): + """ + Generates a cached random array that covers several scenarios that + may affect the benchmark for fairness and to stabilize the benchmark. + + Parameters + ---------- + size: int + Array length. + + dtype: dtype or dtype specifier + + ip_num: int + Input number, to avoid memory overload + and to provide unique data for each operand. + + zeros: bool + Spreading zeros along with generated data. + + finite: bool + Avoid spreading fp special cases nan/inf. + + denormal: + Spreading subnormal numbers along with generated data. + """ + dtype = np.dtype(dtype) + dname = dtype.name + cache_name = f'{dname}_{size}_{ip_num}_{int(zeros)}' + if dtype.kind in 'fc': + cache_name += f'{int(finite)}{int(denormal)}' + cache_name += '.bin' + cache_path = CACHE_ROOT / cache_name + if cache_path.exists(): + return np.fromfile(cache_path, dtype) + + array = np.ones(size, dtype) + rands = [] + if dtype.kind == 'i': + dinfo = np.iinfo(dtype) + scale = 8 + if zeros: + scale += 1 + lsize = size // scale + for low, high in ( + (-0x80, -1), + (1, 0x7f), + (-0x8000, -1), + (1, 0x7fff), + (-0x80000000, -1), + (1, 0x7fffffff), + (-0x8000000000000000, -1), + (1, 0x7fffffffffffffff), + ): + rands += [np.random.randint( + max(low, dinfo.min), + min(high, dinfo.max), + lsize, dtype + )] + elif dtype.kind == 'u': + dinfo = np.iinfo(dtype) + scale = 4 + if zeros: + scale += 1 + lsize = size // scale + for high in (0xff, 0xffff, 0xffffffff, 0xffffffffffffffff): + rands += [np.random.randint(1, min(high, dinfo.max), lsize, dtype)] + elif dtype.kind in 'fc': + scale = 1 + if zeros: + scale += 1 + if not finite: + scale += 2 + if denormal: + scale += 1 + dinfo = np.finfo(dtype) + lsize = size // scale + rands = [np.random.rand(lsize).astype(dtype)] + if not finite: + rands += [ + np.empty(lsize, dtype=dtype), np.empty(lsize, dtype=dtype) + ] + rands[1].fill(float('nan')) + rands[2].fill(float('inf')) + if denormal: + rands += [np.empty(lsize, dtype=dtype)] + rands[-1].fill(dinfo.smallest_subnormal) + + if rands: + if zeros: + rands += [np.zeros(lsize, dtype)] + stride = len(rands) + for start, r in enumerate(rands): + array[start:len(r)*stride:stride] = r + + if not CACHE_ROOT.exists(): + CACHE_ROOT.mkdir(parents=True) + array.tofile(cache_path) + return array + +class Benchmark: + pass diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/LICENSE.txt b/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/LICENSE.txt new file mode 100644 index 0000000000..fee212f6a3 --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/LICENSE.txt @@ -0,0 +1,20 @@ +The MIT License + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall 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. \ No newline at end of file diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/README.md b/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/README.md new file mode 100644 index 0000000000..44501438e4 --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/README.md @@ -0,0 +1,1234 @@ +# Pyperformance benchmark port process for benchmarking with the PolyBench harness + +## Brief explanation + +These benchmarks have been copied from the pyperformance repository and manually updated +so that they conform to the PolyBench contract and they don't use any pyperformance/pyperf interface. +* Remove the usage of `pyperf.Runner` and other `pyperf` functions/classes. +* Move the benchmark workload into the `run` function. +* Define the PolyBench benchmark configuration functions, such as: +`setup`, `warmupIterations`, `iterations`, `summary`, and `dependencies`. + +## Version information + +Version: 1.0.6 +Source repository: Acquired with `pip install` (GitHub repo: https://github.com/python/pyperformance/tree/main) + +The version was chosen to align with the one used in `graalpython/mx.graalpython/mx_graalpython_python_benchmarks.py::PyPerformanceSuite`. + +## Files sourced from the pyperformance project + +The benchmarks from the pyperformance repository have the following characteristics +which do not align with the requirements of the PolyBench harness: +* The benchmark workload is in a `if __name__ == "__main__":` branch. + * The PolyBench harness expects the benchmark workload to be in the `run` function. +* The workload is passed to a `pyperf.Runner` instance for execution. + * The PolyBench harness should execute the workload directly. +* The benchmark has a dependency on `pyperf` for performance measurement purposes. This dependency +is not required for the workload itself. + * As these dependencies are not essential for the workload but used for auxiliary purposes of the + pyperformance harness, they should be eliminated in facilitating benchmarking with the PolyBench harness. + +Additionally, there are special functions that the benchmark may implement to configure the PolyBench execution, +such as: `setup`, `run`, `warmupIterations`, `iterations`, `summary`, and `dependencies`. + +To handle these differences, appropriate changes to the source code of the benchmarks must be made. +These changes are not easy to automate and have therefore been made manually. +The differences have been catalogued in this section, on a file-by-file basis. + +### bm_pathlib.py +Original file path: pyperformance/pyperformance/data-files/benchmarks/bm_pathlib/run_benchmark.py +The file has not been named `pathlib.py` as this name would've hidden the `pathlib` package from the standard library. +Changes made to the original file, as reported by the `diff` tool: +``` +11d10 +< import shutil +14,15d12 +< import pyperf +< +29c26,28 +< def setup(num_files): +--- +> tmp_path = None +> def setup(): +> global tmp_path +31c30 +< for fn in generate_filenames(tmp_path, num_files): +--- +> for fn in generate_filenames(tmp_path, NUM_FILES): +35,36d33 +< return tmp_path +< +49d45 +< t0 = pyperf.perf_counter() +62c58,68 +< return pyperf.perf_counter() - t0 +--- +> +> def run(): +> bench_pathlib(8, tmp_path) +> +> +> def warmupIterations(): +> return 0 +> +> +> def iterations(): +> return 10 +65,77c71,76 +< if __name__ == "__main__": +< runner = pyperf.Runner() +< runner.metadata['description'] = ("Test the performance of " +< "pathlib operations.") +< +< modname = pathlib.__name__ +< runner.metadata['pathlib_module'] = modname +< +< tmp_path = setup(NUM_FILES) +< try: +< runner.bench_time_func('pathlib', bench_pathlib, tmp_path) +< finally: +< shutil.rmtree(tmp_path) +--- +> def summary(): +> return { +> "name": "OutlierRemovalAverageSummary", +> "lower-threshold": 0.0, +> "upper-threshold": 1.0, +> } +``` + +### bm_pickle.py +Original file path: pyperformance/pyperformance/data-files/benchmarks/bm_pickle/run_benchmark.py +The file has not been named `pickle.py` as this name would've hidden the `pickle` package from the standard library. +Changes made to the original file, as reported by the `diff` tool: +``` +18,20c18,19 +< +< import pyperf +< IS_PYPY = (pyperf.python_implementation() == 'pypy') +--- +> import argparse +> import pickle +87d85 +< t0 = pyperf.perf_counter() +113,114d110 +< return pyperf.perf_counter() - t0 +< +126d121 +< t0 = pyperf.perf_counter() +151,152d145 +< return pyperf.perf_counter() - t0 +< +163d155 +< t0 = pyperf.perf_counter() +178,179d169 +< return pyperf.perf_counter() - t0 +< +187d176 +< t0 = pyperf.perf_counter() +202,203d190 +< return pyperf.perf_counter() - t0 +< +213d199 +< t0 = pyperf.perf_counter() +223,224d208 +< return pyperf.perf_counter() - t0 +< +250,252c234,236 +< if __name__ == "__main__": +< runner = pyperf.Runner(add_cmdline_args=add_cmdline_args) +< runner.metadata['description'] = "Test the performance of pickling." +--- +> def run(): +> __benchmark__(["pickle"]) +> +254c238,239 +< parser = runner.argparser +--- +> def __benchmark__(args): +> parser = argparse.ArgumentParser(prog="python") +262,263c247,248 +< options = runner.parse_args() +< benchmark, inner_loops = BENCHMARKS[options.benchmark] +--- +> options = parser.parse_args(args) +> benchmark, _ = BENCHMARKS[options.benchmark] +269c254 +< if not (options.pure_python or IS_PYPY): +--- +> if not options.pure_python: +282,283d266 +< runner.metadata['pickle_protocol'] = str(options.protocol) +< runner.metadata['pickle_module'] = pickle.__name__ +285,286c268,287 +< runner.bench_time_func(name, benchmark, +< pickle, options, inner_loops=inner_loops) +--- +> benchmark(512, pickle, options) +> +> +> def warmupIterations(): +> return 0 +> +> +> def iterations(): +> return 10 +> +> +> def summary(): +> return { +> "name": "OutlierRemovalAverageSummary", +> "lower-threshold": 0.0, +> "upper-threshold": 1.0, +> } +> +> if __name__ == "__main__": +> run() +``` + +### bm_richards.py +Original file path: pyperformance/pyperformance/data-files/benchmarks/bm_richards/run_benchmark.py +The file has not been named `richards.py` as there is already a `richards.py` in micro benchmarks. +Changes made to the original file, as reported by the `diff` tool: +``` +12,13d11 +< import pyperf +< +418,421c416 +< if __name__ == "__main__": +< runner = pyperf.Runner() +< runner.metadata['description'] = "The Richards benchmark" +< +--- +> def run(): +423c418,434 +< runner.bench_func('richards', richard.run, 1) +--- +> richard.run(1) +> +> +> def warmupIterations(): +> return 0 +> +> +> def iterations(): +> return 10 +> +> +> def summary(): +> return { +> "name": "OutlierRemovalAverageSummary", +> "lower-threshold": 0.0, +> "upper-threshold": 1.0, +> } +``` + +### chaos.py +Original file path: pyperformance/pyperformance/data-files/benchmarks/bm_chaos/run_benchmark.py +Changes made to the original file, as reported by the `diff` tool: +``` +8,9c8 +< +< import pyperf +--- +> import argparse +238c237 +< def main(runner, args): +--- +> def __benchmark__(args): +263,268d261 +< runner.metadata['chaos_thickness'] = args.thickness +< runner.metadata['chaos_width'] = args.width +< runner.metadata['chaos_height'] = args.height +< runner.metadata['chaos_iterations'] = args.iterations +< runner.metadata['chaos_rng_seed'] = args.rng_seed +< +270,272c263 +< runner.bench_func('chaos', chaos.create_image_chaos, +< args.width, args.height, args.iterations, +< args.filename, args.rng_seed) +--- +> chaos.create_image_chaos(args.width, args.height, args.iterations, args.filename, args.rng_seed) +284,287c275,276 +< if __name__ == "__main__": +< runner = pyperf.Runner(add_cmdline_args=add_cmdline_args) +< runner.metadata['description'] = "Create chaosgame-like fractals" +< cmd = runner.argparser +--- +> def run(): +> cmd = argparse.ArgumentParser(prog="python") +308,309c297,314 +< args = runner.parse_args() +< main(runner, args) +--- +> args = cmd.parse_args() +> __benchmark__(args) +> +> +> def warmupIterations(): +> return 0 +> +> +> def iterations(): +> return 10 +> +> +> def summary(): +> return { +> "name": "OutlierRemovalAverageSummary", +> "lower-threshold": 0.0, +> "upper-threshold": 1.0, +> } +``` + +### fannkuch.py +Original file path: pyperformance/pyperformance/data-files/benchmarks/bm_fannkuch/run_benchmark.py +Changes made to the original file, as reported by the `diff` tool: +``` +8,9d7 +< import pyperf +< +51,54c49,66 +< if __name__ == "__main__": +< runner = pyperf.Runner() +< arg = DEFAULT_ARG +< runner.bench_func('fannkuch', fannkuch, arg) +--- +> def run(): +> fannkuch(DEFAULT_ARG) +> +> +> def warmupIterations(): +> return 0 +> +> +> def iterations(): +> return 10 +> +> +> def summary(): +> return { +> "name": "OutlierRemovalAverageSummary", +> "lower-threshold": 0.0, +> "upper-threshold": 1.0, +> } +``` + +### float.py +Original file path: pyperformance/pyperformance/data-files/benchmarks/bm_float/run_benchmark.py +Changes made to the original file, as reported by the `diff` tool: +``` +4,5d3 +< import pyperf +< +55,57c53,63 +< if __name__ == "__main__": +< runner = pyperf.Runner() +< runner.metadata['description'] = "Float benchmark" +--- +> def run(): +> benchmark(POINTS) +> +> +> def warmupIterations(): +> return 0 +> +> +> def iterations(): +> return 10 +> +59,60c65,70 +< points = POINTS +< runner.bench_func('float', benchmark, points) +--- +> def summary(): +> return { +> "name": "OutlierRemovalAverageSummary", +> "lower-threshold": 0.0, +> "upper-threshold": 1.0, +> } +``` + +### go.py +Original file path: pyperformance/pyperformance/data-files/benchmarks/bm_go/run_benchmark.py +Changes made to the original file, as reported by the `diff` tool: +``` +7,8d6 +< import pyperf +< +454,461c452,469 +< if __name__ == "__main__": +< kw = {} +< if pyperf.python_has_jit(): +< # PyPy needs to compute more warmup values to warmup its JIT +< kw['warmups'] = 50 +< runner = pyperf.Runner(**kw) +< runner.metadata['description'] = "Test the performance of the Go benchmark" +< runner.bench_func('go', versus_cpu) +--- +> def run(): +> versus_cpu() +> +> +> def warmupIterations(): +> return 0 +> +> +> def iterations(): +> return 10 +> +> +> def summary(): +> return { +> "name": "OutlierRemovalAverageSummary", +> "lower-threshold": 0.0, +> "upper-threshold": 1.0, +> } +``` + +### hexiom.py +Original file path: pyperformance/pyperformance/data-files/benchmarks/bm_hexiom/run_benchmark.py +Changes made to the original file, as reported by the `diff` tool: +``` +12,13c12 +< +< import pyperf +--- +> import argparse +621c620 +< def main(loops, level): +--- +> def __benchmark__(loops, level): +631d629 +< t0 = pyperf.perf_counter() +639,640d636 +< dt = pyperf.perf_counter() - t0 +< +646,647d641 +< return dt +< +653,658c647 +< if __name__ == "__main__": +< kw = {'add_cmdline_args': add_cmdline_args} +< if pyperf.python_has_jit(): +< # PyPy needs to compute more warmup values to warmup its JIT +< kw['warmups'] = 15 +< runner = pyperf.Runner(**kw) +--- +> def run(): +660c649,650 +< runner.argparser.add_argument("--level", type=int, +--- +> parser = argparse.ArgumentParser(prog="python") +> parser.add_argument("--level", type=int, +666,668c656,666 +< args = runner.parse_args() +< runner.metadata['description'] = "Solver of Hexiom board game" +< runner.metadata['hexiom_level'] = args.level +--- +> args = parser.parse_args() +> __benchmark__(16, args.level) +> +> +> def warmupIterations(): +> return 0 +> +> +> def iterations(): +> return 10 +> +670c668,673 +< runner.bench_time_func('hexiom', main, args.level) +--- +> def summary(): +> return { +> "name": "OutlierRemovalAverageSummary", +> "lower-threshold": 0.0, +> "upper-threshold": 1.0, +> } +``` + +### json_dumps.py +Original file path: pyperformance/pyperformance/data-files/benchmarks/bm_json_dumps/run_benchmark.py +Changes made to the original file, as reported by the `diff` tool: +``` +3,4c3 +< +< import pyperf +--- +> import argparse +30,32c29,31 +< def main(): +< runner = pyperf.Runner(add_cmdline_args=add_cmdline_args) +< runner.argparser.add_argument("--cases", +--- +> def run(): +> parser = argparse.ArgumentParser(prog="python") +> parser.add_argument("--cases", +35d33 +< runner.metadata['description'] = "Benchmark json.dumps()" +37c35 +< args = runner.parse_args() +--- +> args = parser.parse_args() +55c53,61 +< runner.bench_func('json_dumps', bench_json_dumps, data) +--- +> bench_json_dumps(data) +> +> +> def warmupIterations(): +> return 0 +> +> +> def iterations(): +> return 10 +58,59c64,69 +< if __name__ == '__main__': +< main() +--- +> def summary(): +> return { +> "name": "OutlierRemovalAverageSummary", +> "lower-threshold": 0.0, +> "upper-threshold": 1.0, +> } +``` + +### json_loads.py +Original file path: pyperformance/pyperformance/data-files/benchmarks/bm_json_loads/run_benchmark.py +Changes made to the original file, as reported by the `diff` tool: +``` +14,16d13 +< # Local imports +< import pyperf +< +97,100c94 +< if __name__ == "__main__": +< runner = pyperf.Runner() +< runner.metadata['description'] = "Benchmark json.loads()" +< +--- +> def run(): +104a99,108 +> bench_json_loads(objs) +> +> +> def warmupIterations(): +> return 0 +> +> +> def iterations(): +> return 10 +> +106c110,115 +< runner.bench_func('json_loads', bench_json_loads, objs, inner_loops=20) +--- +> def summary(): +> return { +> "name": "OutlierRemovalAverageSummary", +> "lower-threshold": 0.0, +> "upper-threshold": 1.0, +> } +``` + +### meteor_contest.py +Original file path: pyperformance/pyperformance/data-files/benchmarks/bm_meteor_contest/run_benchmark.py +Changes made to the original file, as reported by the `diff` tool: +``` +13,14d12 +< import pyperf +< +194d191 +< t0 = pyperf.perf_counter() +204,205d200 +< dt = pyperf.perf_counter() - t0 +< +209,214d203 +< return dt +< +< +< def main(): +< runner = pyperf.Runner() +< runner.metadata['description'] = "Solver for Meteor Puzzle board" +215a205 +> def __benchmark__(): +221,222c211,223 +< runner.bench_time_func('meteor_contest', bench_meteor_contest, +< board, pieces, solve_arg, fps, se_nh) +--- +> bench_meteor_contest(1, board, pieces, solve_arg, fps, se_nh) +> +> +> def run(): +> __benchmark__() +> +> +> def warmupIterations(): +> return 0 +> +> +> def iterations(): +> return 10 +225,226c226,231 +< if __name__ == "__main__": +< main() +--- +> def summary(): +> return { +> "name": "OutlierRemovalAverageSummary", +> "lower-threshold": 0.0, +> "upper-threshold": 1.0, +> } +``` + +### nbody.py +Original file path: pyperformance/pyperformance/data-files/benchmarks/bm_nbody/run_benchmark.py +Changes made to the original file, as reported by the `diff` tool: +``` +17c17 +< import pyperf +--- +> import argparse +128d127 +< t0 = pyperf.perf_counter() +135,136d133 +< return pyperf.perf_counter() - t0 +< +142,145c139,141 +< if __name__ == '__main__': +< runner = pyperf.Runner(add_cmdline_args=add_cmdline_args) +< runner.metadata['description'] = "n-body benchmark" +< runner.argparser.add_argument("--iterations", +--- +> def run(): +> parser = argparse.ArgumentParser(prog="python") +> parser.add_argument("--iterations", +149c145 +< runner.argparser.add_argument("--reference", +--- +> parser.add_argument("--reference", +154,156c150,167 +< args = runner.parse_args() +< runner.bench_time_func('nbody', bench_nbody, +< args.reference, args.iterations) +--- +> args = parser.parse_args() +> bench_nbody(1, args.reference, args.iterations) +> +> +> def warmupIterations(): +> return 0 +> +> +> def iterations(): +> return 10 +> +> +> def summary(): +> return { +> "name": "OutlierRemovalAverageSummary", +> "lower-threshold": 0.0, +> "upper-threshold": 1.0, +> } +``` + +### nqueens.py +Original file path: pyperformance/pyperformance/data-files/benchmarks/bm_nqueens/run_benchmark.py +Changes made to the original file, as reported by the `diff` tool: +``` +3,4d2 +< import pyperf +< +57,59c55,65 +< if __name__ == "__main__": +< runner = pyperf.Runner() +< runner.metadata['description'] = "Simple, brute-force N-Queens solver" +--- +> def run(): +> bench_n_queens(8) +> +> +> def warmupIterations(): +> return 0 +> +> +> def iterations(): +> return 10 +> +61,62c67,72 +< queen_count = 8 +< runner.bench_func('nqueens', bench_n_queens, queen_count) +--- +> def summary(): +> return { +> "name": "OutlierRemovalAverageSummary", +> "lower-threshold": 0.0, +> "upper-threshold": 1.0, +> } +``` + +### pidigits.py +Original file path: pyperformance/pyperformance/data-files/benchmarks/bm_pidigits/run_benchmark.py +Changes made to the original file, as reported by the `diff` tool: +``` +12,13c12 +< +< import pyperf +--- +> import argparse +59,62c58,59 +< if __name__ == "__main__": +< runner = pyperf.Runner(add_cmdline_args=add_cmdline_args) +< +< cmd = runner.argparser +--- +> def run(): +> cmd = argparse.ArgumentParser(prog="python") +67,70c64,81 +< args = runner.parse_args() +< runner.metadata['description'] = "Compute digits of pi." +< runner.metadata['pidigits_ndigit'] = args.digits +< runner.bench_func('pidigits', calc_ndigits, args.digits) +--- +> args = cmd.parse_args() +> calc_ndigits(args.digits) +> +> +> def warmupIterations(): +> return 0 +> +> +> def iterations(): +> return 10 +> +> +> def summary(): +> return { +> "name": "OutlierRemovalAverageSummary", +> "lower-threshold": 0.0, +> "upper-threshold": 1.0, +> } +``` + +### pyflate.py +Original file path: pyperformance/pyperformance/data-files/benchmarks/bm_pyflate/run_benchmark.py +Changes made to the original file, as reported by the `diff` tool: +``` +23,24d22 +< import pyperf +< +635d632 +< t0 = pyperf.perf_counter() +650d646 +< dt = pyperf.perf_counter() - t0 +656,661d651 +< return dt +< +< +< if __name__ == '__main__': +< runner = pyperf.Runner() +< runner.metadata['description'] = "Pyflate benchmark" +662a653 +> def run(): +665c656,676 +< runner.bench_time_func('pyflate', bench_pyflake, filename) +--- +> bench_pyflake(1, filename) +> +> +> def warmupIterations(): +> return 0 +> +> +> def iterations(): +> return 10 +> +> +> def summary(): +> return { +> "name": "OutlierRemovalAverageSummary", +> "lower-threshold": 0.0, +> "upper-threshold": 1.0, +> } +> +> +> def dependencies(): +> return ["data/interpreter.tar.bz2"] +``` + +### regex_compile.py +Original file path: pyperformance/pyperformance/data-files/benchmarks/bm_regex_compile/run_benchmark.py +Changes made to the original file, as reported by the `diff` tool: +``` +11,13c11,12 +< +< # Local imports +< import pyperf +--- +> import sys +> import os +39,40c38,40 +< import bm_regex_effbot +< bm_regex_effbot.bench_regex_effbot(1) +--- +> sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) +> import regex_effbot +> regex_effbot.bench_regex_effbot(1) +42,43c42,43 +< import bm_regex_v8 +< bm_regex_v8.bench_regex_v8(1) +--- +> import regex_v8 +> regex_v8.bench_regex_v8(1) +53d52 +< t0 = pyperf.perf_counter() +61d59 +< return pyperf.perf_counter() - t0 +62a61,63 +> def run(): +> regexes = capture_regexes() +> bench_regex_compile(1, regexes) +64,66d64 +< if __name__ == "__main__": +< runner = pyperf.Runner() +< runner.metadata['description'] = "Test regex compilation performance" +68,69c66,83 +< regexes = capture_regexes() +< runner.bench_time_func('regex_compile', bench_regex_compile, regexes) +--- +> def warmupIterations(): +> return 0 +> +> +> def iterations(): +> return 10 +> +> +> def summary(): +> return { +> "name": "OutlierRemovalAverageSummary", +> "lower-threshold": 0.0, +> "upper-threshold": 1.0, +> } +> +> +> def dependencies(): +> return ["regex_effbot.py", "regex_v8.py"] +``` + +### regex_dna.py +Original file path: pyperformance/pyperformance/data-files/benchmarks/bm_regex_dna/run_benchmark.py +Changes made to the original file, as reported by the `diff` tool: +``` +20,21c20 +< +< import pyperf +--- +> import argparse +189d187 +< t0 = pyperf.perf_counter() +194d191 +< dt = pyperf.perf_counter() - t0 +198,199d194 +< return dt +< +206,212c201,202 +< if __name__ == '__main__': +< runner = pyperf.Runner(add_cmdline_args=add_cmdline_args) +< runner.metadata['description'] = ("Test the performance of regexps " +< "using benchmarks from " +< "The Computer Language Benchmarks Game.") +< +< cmd = runner.argparser +--- +> def run(): +> cmd = argparse.ArgumentParser(prog="python") +220c210 +< args = runner.parse_args() +--- +> args = cmd.parse_args() +229,231d218 +< runner.metadata['regex_dna_fasta_len'] = args.fasta_length +< runner.metadata['regex_dna_rng_seed'] = args.rng_seed +< +236c223,239 +< runner.bench_time_func('regex_dna', bench_regex_dna, seq, expected_res) +--- +> bench_regex_dna(1, seq, expected_res) +> +> +> def warmupIterations(): +> return 0 +> +> +> def iterations(): +> return 10 +> +> +> def summary(): +> return { +> "name": "OutlierRemovalAverageSummary", +> "lower-threshold": 0.0, +> "upper-threshold": 1.0, +> } +``` + +### regex_effbot.py +Original file path: pyperformance/pyperformance/data-files/benchmarks/bm_regex_effbot/run_benchmark.py +Changes made to the original file, as reported by the `diff` tool: +``` +16,18c16 +< +< # Local imports +< import pyperf +--- +> import argparse +135d132 +< t0 = pyperf.perf_counter() +152,153d148 +< return pyperf.perf_counter() - t0 +< +164,168c159,161 +< if __name__ == '__main__': +< runner = pyperf.Runner(add_cmdline_args=add_cmdline_args) +< runner.metadata['description'] = ("Test the performance of regexps " +< "using Fredik Lundh's benchmarks.") +< runner.argparser.add_argument("-B", "--force_bytes", action="store_true", +--- +> def run(): +> parser = argparse.ArgumentParser(prog="python") +> parser.add_argument("-B", "--force_bytes", action="store_true", +170c163 +< options = runner.parse_args() +--- +> options = parser.parse_args() +174,175c167,183 +< runner.bench_time_func('regex_effbot', bench_regex_effbot, +< inner_loops=10) +--- +> bench_regex_effbot(4) +> +> +> def warmupIterations(): +> return 0 +> +> +> def iterations(): +> return 10 +> +> +> def summary(): +> return { +> "name": "OutlierRemovalAverageSummary", +> "lower-threshold": 0.0, +> "upper-threshold": 1.0, +> } +``` + +### regex_v8.py +Original file path: pyperformance/pyperformance/data-files/benchmarks/bm_regex_v8/run_benchmark.py +Changes made to the original file, as reported by the `diff` tool: +``` +45,47d44 +< # Third party imports +< import pyperf +< +1769d1765 +< t0 = pyperf.perf_counter() +1783d1778 +< return pyperf.perf_counter() - t0 +1786,1790c1781,1798 +< if __name__ == '__main__': +< runner = pyperf.Runner() +< runner.metadata['description'] = ("Test the performance of regexps " +< "using V8's benchmarks") +< runner.bench_time_func('regex_v8', bench_regex_v8) +--- +> def run(): +> bench_regex_v8(8) +> +> +> def warmupIterations(): +> return 0 +> +> +> def iterations(): +> return 10 +> +> +> def summary(): +> return { +> "name": "OutlierRemovalAverageSummary", +> "lower-threshold": 0.0, +> "upper-threshold": 1.0, +> } +``` + +### scimark.py +Original file path: pyperformance/pyperformance/data-files/benchmarks/bm_scimark/run_benchmark.py +Changes made to the original file, as reported by the `diff` tool: +``` +3,4c3 +< +< import pyperf +--- +> import argparse +155d153 +< t0 = pyperf.perf_counter() +161,162d158 +< return pyperf.perf_counter() - t0 +< +166d161 +< t0 = pyperf.perf_counter() +175,176d169 +< return pyperf.perf_counter() - t0 +< +214d206 +< t0 = pyperf.perf_counter() +219,220d210 +< return pyperf.perf_counter() - t0 +< +263d252 +< t0 = pyperf.perf_counter() +268,269d256 +< return pyperf.perf_counter() - t0 +< +375d361 +< t0 = pyperf.perf_counter() +383,384d368 +< return pyperf.perf_counter() - t0 +< +393,397c377,381 +< 'sor': (bench_SOR, 100, 10, Array2D), +< 'sparse_mat_mult': (bench_SparseMatMult, 1000, 50 * 1000), +< 'monte_carlo': (bench_MonteCarlo, 100 * 1000,), +< 'lu': (bench_LU, 100,), +< 'fft': (bench_FFT, 1024, 50), +--- +> 'sor': (bench_SOR, 1, 100, 1, Array2D), +> 'sparse_mat_mult': (bench_SparseMatMult, 4, 1000, 50 * 1000), +> 'monte_carlo': (bench_MonteCarlo, 2, 10 * 1000,), +> 'lu': (bench_LU, 1, 50,), +> 'fft': (bench_FFT, 1, 1024, 5), +401,403c385,387 +< if __name__ == "__main__": +< runner = pyperf.Runner(add_cmdline_args=add_cmdline_args) +< runner.argparser.add_argument("benchmark", nargs='?', +--- +> def run(): +> parser = argparse.ArgumentParser(prog="python") +> parser.add_argument("benchmark", nargs='?', +406c390 +< args = runner.parse_args() +--- +> args = parser.parse_args() +413,415c397,414 +< name = 'scimark_%s' % bench +< args = BENCHMARKS[bench] +< runner.bench_time_func(name, *args) +--- +> func, *func_args = BENCHMARKS[bench] +> func(*func_args) +> +> +> def warmupIterations(): +> return 0 +> +> +> def iterations(): +> return 10 +> +> +> def summary(): +> return { +> "name": "OutlierRemovalAverageSummary", +> "lower-threshold": 0.0, +> "upper-threshold": 1.0, +> } +``` + +### spectral_norm.py +Original file path: pyperformance/pyperformance/data-files/benchmarks/bm_spectral_norm/run_benchmark.py +Changes made to the original file, as reported by the `diff` tool: +``` +15,16d14 +< import pyperf +< +51d48 +< t0 = pyperf.perf_counter() +66c63,73 +< return pyperf.perf_counter() - t0 +--- +> +> def run(): +> bench_spectral_norm(1) +> +> +> def warmupIterations(): +> return 0 +> +> +> def iterations(): +> return 10 +69,74c76,81 +< if __name__ == "__main__": +< runner = pyperf.Runner() +< runner.metadata['description'] = ( +< 'MathWorld: "Hundred-Dollar, Hundred-Digit Challenge Problems", ' +< 'Challenge #3.') +< runner.bench_time_func('spectral_norm', bench_spectral_norm) +--- +> def summary(): +> return { +> "name": "OutlierRemovalAverageSummary", +> "lower-threshold": 0.0, +> "upper-threshold": 1.0, +> } +``` + +### telco.py +Original file path: pyperformance/pyperformance/data-files/benchmarks/bm_telco/run_benchmark.py +Changes made to the original file, as reported by the `diff` tool: +``` +23,24d22 +< import pyperf +< +44d41 +< start = pyperf.perf_counter() +81d77 +< return pyperf.perf_counter() - start +82a79,81 +> def run(): +> filename = rel_path("data", "telco-bench.b") +> bench_telco(1, filename) +84,86d82 +< if __name__ == "__main__": +< runner = pyperf.Runner() +< runner.metadata['description'] = "Telco decimal benchmark" +88,89c84,101 +< filename = rel_path("data", "telco-bench.b") +< runner.bench_time_func('telco', bench_telco, filename) +--- +> def warmupIterations(): +> return 0 +> +> +> def iterations(): +> return 10 +> +> +> def summary(): +> return { +> "name": "OutlierRemovalAverageSummary", +> "lower-threshold": 0.0, +> "upper-threshold": 1.0, +> } +> +> +> def dependencies(): +> return ["data/telco-bench.b"] +``` + +### unpack_sequence.py +Original file path: pyperformance/pyperformance/data-files/benchmarks/bm_unpack_sequence/run_benchmark.py +Changes made to the original file, as reported by the `diff` tool: +``` +3c3 +< import pyperf +--- +> import argparse +8d7 +< t0 = pyperf.perf_counter() +413,414d411 +< return pyperf.perf_counter() - t0 +< +418c415 +< return do_unpacking(loops, x) +--- +> do_unpacking(loops, x) +424c421 +< return do_unpacking(loops, x) +--- +> do_unpacking(loops, x) +428,430c425,426 +< dt1 = bench_tuple_unpacking(loops) +< dt2 = bench_list_unpacking(loops) +< return dt1 + dt2 +--- +> bench_tuple_unpacking(loops) +> bench_list_unpacking(loops) +438c434 +< if __name__ == "__main__": +--- +> def run(): +442,446c438,439 +< runner = pyperf.Runner(add_cmdline_args=add_cmdline_args) +< runner.metadata['description'] = ("Microbenchmark for " +< "Python's sequence unpacking.") +< +< runner.argparser.add_argument("benchmark", nargs="?", +--- +> parser = argparse.ArgumentParser(prog="python") +> parser.add_argument("benchmark", nargs="?", +449c442 +< options = runner.parse_args() +--- +> options = parser.parse_args() +457c450,466 +< runner.bench_time_func(name, func, inner_loops=400) +--- +> func(8192) +> +> +> def warmupIterations(): +> return 0 +> +> +> def iterations(): +> return 10 +> +> +> def summary(): +> return { +> "name": "OutlierRemovalAverageSummary", +> "lower-threshold": 0.0, +> "upper-threshold": 1.0, +> } +``` + +### data/interpreter.tar.bz2 +Original file path: pyperformance/pyperformance/data-files/benchmarks/bm_pyflate/data/interpreter.tar.bz2 +Data file used for the `pyflate.py` benchmark. +No modifications made. + +### data/telco-bench.b +Original file path: pyperformance/pyperformance/data-files/benchmarks/bm_telco/data/telco-bench.b +Data file used for the `telco.py` benchmark. +No modifications made. + +## Original files necessary for benchmarking with the PolyBench harness + +These are new files that do not have a corresponding match in the numpy repository. +These files are generated to conform to the expectations of the PolyBench harness. + +### pickle_dict.py +Invokes the benchmark implemented in `bm_pickle.py` with the `["pickle_dict"]` argument value. +This file is the PolyBench equivalent of the pyperformance benchmark variant defined in the +`pyperformance/pyperformance/data-files/benchmarks/bm_pickle/bm_pickle_dict.toml` file. + +### pickle_list.py +Invokes the benchmark implemented in `bm_pickle.py` with the `["pickle_list"]` argument value. +This file is the PolyBench equivalent of the pyperformance benchmark variant defined in the +`pyperformance/pyperformance/data-files/benchmarks/bm_pickle/bm_pickle_list.toml` file. + +### unpickle_list.py +Invokes the benchmark implemented in `bm_pickle.py` with the `["unpickle_list"]` argument value. +This file is the PolyBench equivalent of the pyperformance benchmark variant defined in the +`pyperformance/pyperformance/data-files/benchmarks/bm_pickle/bm_unpickle_list.toml` file. + +### unpickle.py +Invokes the benchmark implemented in `bm_pickle.py` with the `["unpickle"]` argument value. +This file is the PolyBench equivalent of the pyperformance benchmark variant defined in the +`pyperformance/pyperformance/data-files/benchmarks/bm_pickle/bm_unpickle.toml` file. diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/bm_pathlib.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/bm_pathlib.py new file mode 100644 index 0000000000..ec7f2e01cd --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/bm_pathlib.py @@ -0,0 +1,76 @@ +""" +Test the performance of pathlib operations. + +This benchmark stresses the creation of small objects, globbing, and system +calls. +""" + +# Python imports +import os +import pathlib +import tempfile + + +NUM_FILES = 2000 + + +def generate_filenames(tmp_path, num_files): + i = 0 + while num_files: + for ext in [".py", ".txt", ".tar.gz", ""]: + i += 1 + yield os.path.join(tmp_path, str(i) + ext) + num_files -= 1 + + +tmp_path = None +def setup(): + global tmp_path + tmp_path = tempfile.mkdtemp() + for fn in generate_filenames(tmp_path, NUM_FILES): + with open(fn, "wb") as f: + f.write(b'benchmark') + + +def bench_pathlib(loops, tmp_path): + base_path = pathlib.Path(tmp_path) + + # Warm up the filesystem cache and keep some objects in memory. + path_objects = list(base_path.iterdir()) + # FIXME: does this code really cache anything? + for p in path_objects: + p.stat() + assert len(path_objects) == NUM_FILES, len(path_objects) + + range_it = range(loops) + + for _ in range_it: + # Do something simple with each path. + for p in base_path.iterdir(): + p.stat() + for p in base_path.glob("*.py"): + p.stat() + for p in base_path.iterdir(): + p.stat() + for p in base_path.glob("*.py"): + p.stat() + + +def run(): + bench_pathlib(8, tmp_path) + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/bm_pickle.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/bm_pickle.py new file mode 100644 index 0000000000..d4ec077eb6 --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/bm_pickle.py @@ -0,0 +1,287 @@ + +"""Script for testing the performance of pickling/unpickling. + +This will pickle/unpickle several real world-representative objects a few +thousand times. The methodology below was chosen for was chosen to be similar +to real-world scenarios which operate on single objects at a time. Note that if +we did something like + + pickle.dumps([dict(some_dict) for _ in range(10000)]) + +this isn't equivalent to dumping the dict 10000 times: pickle uses a +highly-efficient encoding for the n-1 following copies. +""" + +import datetime +import random +import sys +import argparse +import pickle + +__author__ = "collinwinter@google.com (Collin Winter)" + + +DICT = { + 'ads_flags': 0, + 'age': 18, + 'birthday': datetime.date(1980, 5, 7), + 'bulletin_count': 0, + 'comment_count': 0, + 'country': 'BR', + 'encrypted_id': 'G9urXXAJwjE', + 'favorite_count': 9, + 'first_name': '', + 'flags': 412317970704, + 'friend_count': 0, + 'gender': 'm', + 'gender_for_display': 'Male', + 'id': 302935349, + 'is_custom_profile_icon': 0, + 'last_name': '', + 'locale_preference': 'pt_BR', + 'member': 0, + 'tags': ['a', 'b', 'c', 'd', 'e', 'f', 'g'], + 'profile_foo_id': 827119638, + 'secure_encrypted_id': 'Z_xxx2dYx3t4YAdnmfgyKw', + 'session_number': 2, + 'signup_id': '201-19225-223', + 'status': 'A', + 'theme': 1, + 'time_created': 1225237014, + 'time_updated': 1233134493, + 'unread_message_count': 0, + 'user_group': '0', + 'username': 'collinwinter', + 'play_count': 9, + 'view_count': 7, + 'zip': ''} + +TUPLE = ( + [265867233, 265868503, 265252341, 265243910, 265879514, + 266219766, 266021701, 265843726, 265592821, 265246784, + 265853180, 45526486, 265463699, 265848143, 265863062, + 265392591, 265877490, 265823665, 265828884, 265753032], 60) + + +def mutate_dict(orig_dict, random_source): + new_dict = dict(orig_dict) + for key, value in new_dict.items(): + rand_val = random_source.random() * sys.maxsize + if isinstance(key, (int, bytes, str)): + new_dict[key] = type(key)(rand_val) + return new_dict + + +random_source = random.Random(5) # Fixed seed. +DICT_GROUP = [mutate_dict(DICT, random_source) for _ in range(3)] + + +def bench_pickle(loops, pickle, options): + range_it = range(loops) + + # micro-optimization: use fast local variables + dumps = pickle.dumps + objs = (DICT, TUPLE, DICT_GROUP) + protocol = options.protocol + + for _ in range_it: + for obj in objs: + # 20 dumps + dumps(obj, protocol) + dumps(obj, protocol) + dumps(obj, protocol) + dumps(obj, protocol) + dumps(obj, protocol) + dumps(obj, protocol) + dumps(obj, protocol) + dumps(obj, protocol) + dumps(obj, protocol) + dumps(obj, protocol) + dumps(obj, protocol) + dumps(obj, protocol) + dumps(obj, protocol) + dumps(obj, protocol) + dumps(obj, protocol) + dumps(obj, protocol) + dumps(obj, protocol) + dumps(obj, protocol) + dumps(obj, protocol) + dumps(obj, protocol) + + +def bench_unpickle(loops, pickle, options): + pickled_dict = pickle.dumps(DICT, options.protocol) + pickled_tuple = pickle.dumps(TUPLE, options.protocol) + pickled_dict_group = pickle.dumps(DICT_GROUP, options.protocol) + range_it = range(loops) + + # micro-optimization: use fast local variables + loads = pickle.loads + objs = (pickled_dict, pickled_tuple, pickled_dict_group) + + for _ in range_it: + for obj in objs: + # 20 loads dict + loads(obj) + loads(obj) + loads(obj) + loads(obj) + loads(obj) + loads(obj) + loads(obj) + loads(obj) + loads(obj) + loads(obj) + loads(obj) + loads(obj) + loads(obj) + loads(obj) + loads(obj) + loads(obj) + loads(obj) + loads(obj) + loads(obj) + loads(obj) + + +LIST = [[list(range(10)), list(range(10))] for _ in range(10)] + + +def bench_pickle_list(loops, pickle, options): + range_it = range(loops) + # micro-optimization: use fast local variables + dumps = pickle.dumps + obj = LIST + protocol = options.protocol + + for _ in range_it: + # 10 dumps list + dumps(obj, protocol) + dumps(obj, protocol) + dumps(obj, protocol) + dumps(obj, protocol) + dumps(obj, protocol) + dumps(obj, protocol) + dumps(obj, protocol) + dumps(obj, protocol) + dumps(obj, protocol) + dumps(obj, protocol) + + +def bench_unpickle_list(loops, pickle, options): + pickled_list = pickle.dumps(LIST, options.protocol) + range_it = range(loops) + + # micro-optimization: use fast local variables + loads = pickle.loads + + for _ in range_it: + # 10 loads list + loads(pickled_list) + loads(pickled_list) + loads(pickled_list) + loads(pickled_list) + loads(pickled_list) + loads(pickled_list) + loads(pickled_list) + loads(pickled_list) + loads(pickled_list) + loads(pickled_list) + + +MICRO_DICT = dict((key, dict.fromkeys(range(10))) for key in range(100)) + + +def bench_pickle_dict(loops, pickle, options): + range_it = range(loops) + # micro-optimization: use fast local variables + protocol = options.protocol + obj = MICRO_DICT + + for _ in range_it: + # 5 dumps dict + pickle.dumps(obj, protocol) + pickle.dumps(obj, protocol) + pickle.dumps(obj, protocol) + pickle.dumps(obj, protocol) + pickle.dumps(obj, protocol) + + +BENCHMARKS = { + # 20 inner-loops: don't count the 3 pickled objects + 'pickle': (bench_pickle, 20), + + # 20 inner-loops: don't count the 3 unpickled objects + 'unpickle': (bench_unpickle, 20), + + 'pickle_list': (bench_pickle_list, 10), + 'unpickle_list': (bench_unpickle_list, 10), + 'pickle_dict': (bench_pickle_dict, 5), +} + + +def is_accelerated_module(module): + return getattr(pickle.Pickler, '__module__', '') != 'pickle' + + +def add_cmdline_args(cmd, args): + if args.pure_python: + cmd.append("--pure-python") + cmd.extend(("--protocol", str(args.protocol))) + cmd.append(args.benchmark) + + +def run(): + __benchmark__(["pickle"]) + + +def __benchmark__(args): + parser = argparse.ArgumentParser(prog="python") + parser.add_argument("--pure-python", action="store_true", + help="Use the C version of pickle.") + parser.add_argument("--protocol", action="store", default=None, type=int, + help="Which protocol to use (default: highest protocol).") + benchmarks = sorted(BENCHMARKS) + parser.add_argument("benchmark", choices=benchmarks) + + options = parser.parse_args(args) + benchmark, _ = BENCHMARKS[options.benchmark] + + name = options.benchmark + if options.pure_python: + name += "_pure_python" + + if not options.pure_python: + # C accelerators are enabled by default on 3.x + import pickle + if not is_accelerated_module(pickle): + raise RuntimeError("Missing C accelerators for pickle") + else: + sys.modules['_pickle'] = None + import pickle + if is_accelerated_module(pickle): + raise RuntimeError("Unexpected C accelerators for pickle") + + if options.protocol is None: + options.protocol = pickle.HIGHEST_PROTOCOL + + benchmark(512, pickle, options) + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } + +if __name__ == "__main__": + run() diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/bm_richards.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/bm_richards.py new file mode 100644 index 0000000000..90b72a3aec --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/bm_richards.py @@ -0,0 +1,434 @@ +""" +based on a Java version: + Based on original version written in BCPL by Dr Martin Richards + in 1981 at Cambridge University Computer Laboratory, England + and a C++ version derived from a Smalltalk version written by + L Peter Deutsch. + Java version: Copyright (C) 1995 Sun Microsystems, Inc. + Translation from C++, Mario Wolczko + Outer loop added by Alex Jacoby +""" + + +# Task IDs +I_IDLE = 1 +I_WORK = 2 +I_HANDLERA = 3 +I_HANDLERB = 4 +I_DEVA = 5 +I_DEVB = 6 + +# Packet types +K_DEV = 1000 +K_WORK = 1001 + +# Packet + +BUFSIZE = 4 + +BUFSIZE_RANGE = range(BUFSIZE) + + +class Packet(object): + + def __init__(self, l, i, k): + self.link = l + self.ident = i + self.kind = k + self.datum = 0 + self.data = [0] * BUFSIZE + + def append_to(self, lst): + self.link = None + if lst is None: + return self + else: + p = lst + next = p.link + while next is not None: + p = next + next = p.link + p.link = self + return lst + +# Task Records + + +class TaskRec(object): + pass + + +class DeviceTaskRec(TaskRec): + + def __init__(self): + self.pending = None + + +class IdleTaskRec(TaskRec): + + def __init__(self): + self.control = 1 + self.count = 10000 + + +class HandlerTaskRec(TaskRec): + + def __init__(self): + self.work_in = None + self.device_in = None + + def workInAdd(self, p): + self.work_in = p.append_to(self.work_in) + return self.work_in + + def deviceInAdd(self, p): + self.device_in = p.append_to(self.device_in) + return self.device_in + + +class WorkerTaskRec(TaskRec): + + def __init__(self): + self.destination = I_HANDLERA + self.count = 0 +# Task + + +class TaskState(object): + + def __init__(self): + self.packet_pending = True + self.task_waiting = False + self.task_holding = False + + def packetPending(self): + self.packet_pending = True + self.task_waiting = False + self.task_holding = False + return self + + def waiting(self): + self.packet_pending = False + self.task_waiting = True + self.task_holding = False + return self + + def running(self): + self.packet_pending = False + self.task_waiting = False + self.task_holding = False + return self + + def waitingWithPacket(self): + self.packet_pending = True + self.task_waiting = True + self.task_holding = False + return self + + def isPacketPending(self): + return self.packet_pending + + def isTaskWaiting(self): + return self.task_waiting + + def isTaskHolding(self): + return self.task_holding + + def isTaskHoldingOrWaiting(self): + return self.task_holding or (not self.packet_pending and self.task_waiting) + + def isWaitingWithPacket(self): + return self.packet_pending and self.task_waiting and not self.task_holding + + +tracing = False +layout = 0 + + +def trace(a): + global layout + layout -= 1 + if layout <= 0: + print() + layout = 50 + print(a, end='') + + +TASKTABSIZE = 10 + + +class TaskWorkArea(object): + + def __init__(self): + self.taskTab = [None] * TASKTABSIZE + + self.taskList = None + + self.holdCount = 0 + self.qpktCount = 0 + + +taskWorkArea = TaskWorkArea() + + +class Task(TaskState): + + def __init__(self, i, p, w, initialState, r): + self.link = taskWorkArea.taskList + self.ident = i + self.priority = p + self.input = w + + self.packet_pending = initialState.isPacketPending() + self.task_waiting = initialState.isTaskWaiting() + self.task_holding = initialState.isTaskHolding() + + self.handle = r + + taskWorkArea.taskList = self + taskWorkArea.taskTab[i] = self + + def fn(self, pkt, r): + raise NotImplementedError + + def addPacket(self, p, old): + if self.input is None: + self.input = p + self.packet_pending = True + if self.priority > old.priority: + return self + else: + p.append_to(self.input) + return old + + def runTask(self): + if self.isWaitingWithPacket(): + msg = self.input + self.input = msg.link + if self.input is None: + self.running() + else: + self.packetPending() + else: + msg = None + + return self.fn(msg, self.handle) + + def waitTask(self): + self.task_waiting = True + return self + + def hold(self): + taskWorkArea.holdCount += 1 + self.task_holding = True + return self.link + + def release(self, i): + t = self.findtcb(i) + t.task_holding = False + if t.priority > self.priority: + return t + else: + return self + + def qpkt(self, pkt): + t = self.findtcb(pkt.ident) + taskWorkArea.qpktCount += 1 + pkt.link = None + pkt.ident = self.ident + return t.addPacket(pkt, self) + + def findtcb(self, id): + t = taskWorkArea.taskTab[id] + if t is None: + raise Exception("Bad task id %d" % id) + return t + + +# DeviceTask + + +class DeviceTask(Task): + + def __init__(self, i, p, w, s, r): + Task.__init__(self, i, p, w, s, r) + + def fn(self, pkt, r): + d = r + assert isinstance(d, DeviceTaskRec) + if pkt is None: + pkt = d.pending + if pkt is None: + return self.waitTask() + else: + d.pending = None + return self.qpkt(pkt) + else: + d.pending = pkt + if tracing: + trace(pkt.datum) + return self.hold() + + +class HandlerTask(Task): + + def __init__(self, i, p, w, s, r): + Task.__init__(self, i, p, w, s, r) + + def fn(self, pkt, r): + h = r + assert isinstance(h, HandlerTaskRec) + if pkt is not None: + if pkt.kind == K_WORK: + h.workInAdd(pkt) + else: + h.deviceInAdd(pkt) + work = h.work_in + if work is None: + return self.waitTask() + count = work.datum + if count >= BUFSIZE: + h.work_in = work.link + return self.qpkt(work) + + dev = h.device_in + if dev is None: + return self.waitTask() + + h.device_in = dev.link + dev.datum = work.data[count] + work.datum = count + 1 + return self.qpkt(dev) + +# IdleTask + + +class IdleTask(Task): + + def __init__(self, i, p, w, s, r): + Task.__init__(self, i, 0, None, s, r) + + def fn(self, pkt, r): + i = r + assert isinstance(i, IdleTaskRec) + i.count -= 1 + if i.count == 0: + return self.hold() + elif i.control & 1 == 0: + i.control //= 2 + return self.release(I_DEVA) + else: + i.control = i.control // 2 ^ 0xd008 + return self.release(I_DEVB) + + +# WorkTask + + +A = ord('A') + + +class WorkTask(Task): + + def __init__(self, i, p, w, s, r): + Task.__init__(self, i, p, w, s, r) + + def fn(self, pkt, r): + w = r + assert isinstance(w, WorkerTaskRec) + if pkt is None: + return self.waitTask() + + if w.destination == I_HANDLERA: + dest = I_HANDLERB + else: + dest = I_HANDLERA + + w.destination = dest + pkt.ident = dest + pkt.datum = 0 + + for i in BUFSIZE_RANGE: # range(BUFSIZE) + w.count += 1 + if w.count > 26: + w.count = 1 + pkt.data[i] = A + w.count - 1 + + return self.qpkt(pkt) + + +def schedule(): + t = taskWorkArea.taskList + while t is not None: + if tracing: + print("tcb =", t.ident) + + if t.isTaskHoldingOrWaiting(): + t = t.link + else: + if tracing: + trace(chr(ord("0") + t.ident)) + t = t.runTask() + + +class Richards(object): + + def run(self, iterations): + for i in range(iterations): + taskWorkArea.holdCount = 0 + taskWorkArea.qpktCount = 0 + + IdleTask(I_IDLE, 1, 10000, TaskState().running(), IdleTaskRec()) + + wkq = Packet(None, 0, K_WORK) + wkq = Packet(wkq, 0, K_WORK) + WorkTask(I_WORK, 1000, wkq, TaskState( + ).waitingWithPacket(), WorkerTaskRec()) + + wkq = Packet(None, I_DEVA, K_DEV) + wkq = Packet(wkq, I_DEVA, K_DEV) + wkq = Packet(wkq, I_DEVA, K_DEV) + HandlerTask(I_HANDLERA, 2000, wkq, TaskState( + ).waitingWithPacket(), HandlerTaskRec()) + + wkq = Packet(None, I_DEVB, K_DEV) + wkq = Packet(wkq, I_DEVB, K_DEV) + wkq = Packet(wkq, I_DEVB, K_DEV) + HandlerTask(I_HANDLERB, 3000, wkq, TaskState( + ).waitingWithPacket(), HandlerTaskRec()) + + wkq = None + DeviceTask(I_DEVA, 4000, wkq, + TaskState().waiting(), DeviceTaskRec()) + DeviceTask(I_DEVB, 5000, wkq, + TaskState().waiting(), DeviceTaskRec()) + + schedule() + + if taskWorkArea.holdCount == 9297 and taskWorkArea.qpktCount == 23246: + pass + else: + return False + + return True + + +def run(): + richard = Richards() + richard.run(1) + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/chaos.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/chaos.py new file mode 100644 index 0000000000..008938367b --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/chaos.py @@ -0,0 +1,314 @@ +"""create chaosgame-like fractals + +Copyright (C) 2005 Carl Friedrich Bolz +""" + +import math +import random +import argparse + + +DEFAULT_THICKNESS = 0.25 +DEFAULT_WIDTH = 256 +DEFAULT_HEIGHT = 256 +DEFAULT_ITERATIONS = 5000 +DEFAULT_RNG_SEED = 1234 + + +class GVector(object): + + def __init__(self, x=0, y=0, z=0): + self.x = x + self.y = y + self.z = z + + def Mag(self): + return math.sqrt(self.x ** 2 + self.y ** 2 + self.z ** 2) + + def dist(self, other): + return math.sqrt((self.x - other.x) ** 2 + + (self.y - other.y) ** 2 + + (self.z - other.z) ** 2) + + def __add__(self, other): + if not isinstance(other, GVector): + raise ValueError("Can't add GVector to " + str(type(other))) + v = GVector(self.x + other.x, self.y + other.y, self.z + other.z) + return v + + def __sub__(self, other): + return self + other * -1 + + def __mul__(self, other): + v = GVector(self.x * other, self.y * other, self.z * other) + return v + __rmul__ = __mul__ + + def linear_combination(self, other, l1, l2=None): + if l2 is None: + l2 = 1 - l1 + v = GVector(self.x * l1 + other.x * l2, + self.y * l1 + other.y * l2, + self.z * l1 + other.z * l2) + return v + + def __str__(self): + return "<%f, %f, %f>" % (self.x, self.y, self.z) + + def __repr__(self): + return "GVector(%f, %f, %f)" % (self.x, self.y, self.z) + + +class Spline(object): + """Class for representing B-Splines and NURBS of arbitrary degree""" + + def __init__(self, points, degree, knots): + """Creates a Spline. + + points is a list of GVector, degree is the degree of the Spline. + """ + if len(points) > len(knots) - degree + 1: + raise ValueError("too many control points") + elif len(points) < len(knots) - degree + 1: + raise ValueError("not enough control points") + last = knots[0] + for cur in knots[1:]: + if cur < last: + raise ValueError("knots not strictly increasing") + last = cur + self.knots = knots + self.points = points + self.degree = degree + + def GetDomain(self): + """Returns the domain of the B-Spline""" + return (self.knots[self.degree - 1], + self.knots[len(self.knots) - self.degree]) + + def __call__(self, u): + """Calculates a point of the B-Spline using de Boors Algorithm""" + dom = self.GetDomain() + if u < dom[0] or u > dom[1]: + raise ValueError("Function value not in domain") + if u == dom[0]: + return self.points[0] + if u == dom[1]: + return self.points[-1] + I = self.GetIndex(u) + d = [self.points[I - self.degree + 1 + ii] + for ii in range(self.degree + 1)] + U = self.knots + for ik in range(1, self.degree + 1): + for ii in range(I - self.degree + ik + 1, I + 2): + ua = U[ii + self.degree - ik] + ub = U[ii - 1] + co1 = (ua - u) / (ua - ub) + co2 = (u - ub) / (ua - ub) + index = ii - I + self.degree - ik - 1 + d[index] = d[index].linear_combination(d[index + 1], co1, co2) + return d[0] + + def GetIndex(self, u): + dom = self.GetDomain() + for ii in range(self.degree - 1, len(self.knots) - self.degree): + if u >= self.knots[ii] and u < self.knots[ii + 1]: + I = ii + break + else: + I = dom[1] - 1 + return I + + def __len__(self): + return len(self.points) + + def __repr__(self): + return "Spline(%r, %r, %r)" % (self.points, self.degree, self.knots) + + +def write_ppm(im, filename): + magic = 'P6\n' + maxval = 255 + w = len(im) + h = len(im[0]) + + with open(filename, "w", encoding="latin1", newline='') as fp: + fp.write(magic) + fp.write('%i %i\n%i\n' % (w, h, maxval)) + for j in range(h): + for i in range(w): + val = im[i][j] + c = val * 255 + fp.write('%c%c%c' % (c, c, c)) + + +class Chaosgame(object): + + def __init__(self, splines, thickness=0.1): + self.splines = splines + self.thickness = thickness + self.minx = min([p.x for spl in splines for p in spl.points]) + self.miny = min([p.y for spl in splines for p in spl.points]) + self.maxx = max([p.x for spl in splines for p in spl.points]) + self.maxy = max([p.y for spl in splines for p in spl.points]) + self.height = self.maxy - self.miny + self.width = self.maxx - self.minx + self.num_trafos = [] + maxlength = thickness * self.width / self.height + for spl in splines: + length = 0 + curr = spl(0) + for i in range(1, 1000): + last = curr + t = 1 / 999 * i + curr = spl(t) + length += curr.dist(last) + self.num_trafos.append(max(1, int(length / maxlength * 1.5))) + self.num_total = sum(self.num_trafos) + + def get_random_trafo(self): + r = random.randrange(int(self.num_total) + 1) + l = 0 + for i in range(len(self.num_trafos)): + if r >= l and r < l + self.num_trafos[i]: + return i, random.randrange(self.num_trafos[i]) + l += self.num_trafos[i] + return len(self.num_trafos) - 1, random.randrange(self.num_trafos[-1]) + + def transform_point(self, point, trafo=None): + x = (point.x - self.minx) / self.width + y = (point.y - self.miny) / self.height + if trafo is None: + trafo = self.get_random_trafo() + start, end = self.splines[trafo[0]].GetDomain() + length = end - start + seg_length = length / self.num_trafos[trafo[0]] + t = start + seg_length * trafo[1] + seg_length * x + basepoint = self.splines[trafo[0]](t) + if t + 1 / 50000 > end: + neighbour = self.splines[trafo[0]](t - 1 / 50000) + derivative = neighbour - basepoint + else: + neighbour = self.splines[trafo[0]](t + 1 / 50000) + derivative = basepoint - neighbour + if derivative.Mag() != 0: + basepoint.x += derivative.y / derivative.Mag() * (y - 0.5) * \ + self.thickness + basepoint.y += -derivative.x / derivative.Mag() * (y - 0.5) * \ + self.thickness + else: + print("r", end='') + self.truncate(basepoint) + return basepoint + + def truncate(self, point): + if point.x >= self.maxx: + point.x = self.maxx + if point.y >= self.maxy: + point.y = self.maxy + if point.x < self.minx: + point.x = self.minx + if point.y < self.miny: + point.y = self.miny + + def create_image_chaos(self, w, h, iterations, filename, rng_seed): + # Always use the same sequence of random numbers + # to get reproductible benchmark + random.seed(rng_seed) + + im = [[1] * h for i in range(w)] + point = GVector((self.maxx + self.minx) / 2, + (self.maxy + self.miny) / 2, 0) + for _ in range(iterations): + point = self.transform_point(point) + x = (point.x - self.minx) / self.width * w + y = (point.y - self.miny) / self.height * h + x = int(x) + y = int(y) + if x == w: + x -= 1 + if y == h: + y -= 1 + im[x][h - y - 1] = 0 + + if filename: + write_ppm(im, filename) + + +def __benchmark__(args): + splines = [ + Spline([ + GVector(1.597350, 3.304460, 0.000000), + GVector(1.575810, 4.123260, 0.000000), + GVector(1.313210, 5.288350, 0.000000), + GVector(1.618900, 5.329910, 0.000000), + GVector(2.889940, 5.502700, 0.000000), + GVector(2.373060, 4.381830, 0.000000), + GVector(1.662000, 4.360280, 0.000000)], + 3, [0, 0, 0, 1, 1, 1, 2, 2, 2]), + Spline([ + GVector(2.804500, 4.017350, 0.000000), + GVector(2.550500, 3.525230, 0.000000), + GVector(1.979010, 2.620360, 0.000000), + GVector(1.979010, 2.620360, 0.000000)], + 3, [0, 0, 0, 1, 1, 1]), + Spline([ + GVector(2.001670, 4.011320, 0.000000), + GVector(2.335040, 3.312830, 0.000000), + GVector(2.366800, 3.233460, 0.000000), + GVector(2.366800, 3.233460, 0.000000)], + 3, [0, 0, 0, 1, 1, 1]) + ] + + chaos = Chaosgame(splines, args.thickness) + chaos.create_image_chaos(args.width, args.height, args.iterations, args.filename, args.rng_seed) + + +def add_cmdline_args(cmd, args): + cmd.append("--width=%s" % args.width) + cmd.append("--height=%s" % args.height) + cmd.append("--thickness=%s" % args.thickness) + cmd.append("--rng-seed=%s" % args.rng_seed) + if args.filename: + cmd.extend(("--filename", args.filename)) + + +def run(): + cmd = argparse.ArgumentParser(prog="python") + cmd.add_argument("--thickness", + type=float, default=DEFAULT_THICKNESS, + help="Thickness (default: %s)" % DEFAULT_THICKNESS) + cmd.add_argument("--width", + type=int, default=DEFAULT_WIDTH, + help="Image width (default: %s)" % DEFAULT_WIDTH) + cmd.add_argument("--height", + type=int, default=DEFAULT_HEIGHT, + help="Image height (default: %s)" % DEFAULT_HEIGHT) + cmd.add_argument("--iterations", + type=int, default=DEFAULT_ITERATIONS, + help="Number of iterations (default: %s)" + % DEFAULT_ITERATIONS) + cmd.add_argument("--filename", metavar="FILENAME.PPM", + help="Output filename of the PPM picture") + cmd.add_argument("--rng-seed", + type=int, default=DEFAULT_RNG_SEED, + help="Random number generator seed (default: %s)" + % DEFAULT_RNG_SEED) + + args = cmd.parse_args() + __benchmark__(args) + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/data/interpreter.tar.bz2 b/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/data/interpreter.tar.bz2 new file mode 100644 index 0000000000..67bf5a89eb Binary files /dev/null and b/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/data/interpreter.tar.bz2 differ diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/data/telco-bench.b b/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/data/telco-bench.b new file mode 100644 index 0000000000..2c7085d073 Binary files /dev/null and b/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/data/telco-bench.b differ diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/fannkuch.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/fannkuch.py new file mode 100644 index 0000000000..f802721521 --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/fannkuch.py @@ -0,0 +1,66 @@ +""" +The Computer Language Benchmarks Game +http://benchmarksgame.alioth.debian.org/ + +Contributed by Sokolov Yura, modified by Tupteq. +""" + + +DEFAULT_ARG = 9 + + +def fannkuch(n): + count = list(range(1, n + 1)) + max_flips = 0 + m = n - 1 + r = n + perm1 = list(range(n)) + perm = list(range(n)) + perm1_ins = perm1.insert + perm1_pop = perm1.pop + + while 1: + while r != 1: + count[r - 1] = r + r -= 1 + + if perm1[0] != 0 and perm1[m] != m: + perm = perm1[:] + flips_count = 0 + k = perm[0] + while k: + perm[:k + 1] = perm[k::-1] + flips_count += 1 + k = perm[0] + + if flips_count > max_flips: + max_flips = flips_count + + while r != n: + perm1_ins(r, perm1_pop(0)) + count[r] -= 1 + if count[r] > 0: + break + r += 1 + else: + return max_flips + + +def run(): + fannkuch(DEFAULT_ARG) + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/float.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/float.py new file mode 100644 index 0000000000..3db5c78379 --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/float.py @@ -0,0 +1,70 @@ +""" +Artificial, floating point-heavy benchmark originally used by Factor. +""" +from math import sin, cos, sqrt + + +POINTS = 100000 + + +class Point(object): + __slots__ = ('x', 'y', 'z') + + def __init__(self, i): + self.x = x = sin(i) + self.y = cos(i) * 3 + self.z = (x * x) / 2 + + def __repr__(self): + return "" % (self.x, self.y, self.z) + + def normalize(self): + x = self.x + y = self.y + z = self.z + norm = sqrt(x * x + y * y + z * z) + self.x /= norm + self.y /= norm + self.z /= norm + + def maximize(self, other): + self.x = self.x if self.x > other.x else other.x + self.y = self.y if self.y > other.y else other.y + self.z = self.z if self.z > other.z else other.z + return self + + +def maximize(points): + next = points[0] + for p in points[1:]: + next = next.maximize(p) + return next + + +def benchmark(n): + points = [None] * n + for i in range(n): + points[i] = Point(i) + for p in points: + p.normalize() + return maximize(points) + + +def run(): + benchmark(POINTS) + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/go.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/go.py new file mode 100644 index 0000000000..cd43765c73 --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/go.py @@ -0,0 +1,469 @@ +""" +Go board game +""" +import math +import random + + +SIZE = 9 +GAMES = 200 +KOMI = 7.5 +EMPTY, WHITE, BLACK = 0, 1, 2 +SHOW = {EMPTY: '.', WHITE: 'o', BLACK: 'x'} +PASS = -1 +MAXMOVES = SIZE * SIZE * 3 +TIMESTAMP = 0 +MOVES = 0 + + +def to_pos(x, y): + return y * SIZE + x + + +def to_xy(pos): + y, x = divmod(pos, SIZE) + return x, y + + +class Square: + + def __init__(self, board, pos): + self.board = board + self.pos = pos + self.timestamp = TIMESTAMP + self.removestamp = TIMESTAMP + self.zobrist_strings = [random.randrange(9223372036854775807) + for i in range(3)] + + def set_neighbours(self): + x, y = self.pos % SIZE, self.pos // SIZE + self.neighbours = [] + for dx, dy in [(-1, 0), (1, 0), (0, -1), (0, 1)]: + newx, newy = x + dx, y + dy + if 0 <= newx < SIZE and 0 <= newy < SIZE: + self.neighbours.append(self.board.squares[to_pos(newx, newy)]) + + def move(self, color): + global TIMESTAMP, MOVES + TIMESTAMP += 1 + MOVES += 1 + self.board.zobrist.update(self, color) + self.color = color + self.reference = self + self.ledges = 0 + self.used = True + for neighbour in self.neighbours: + neighcolor = neighbour.color + if neighcolor == EMPTY: + self.ledges += 1 + else: + neighbour_ref = neighbour.find(update=True) + if neighcolor == color: + if neighbour_ref.reference.pos != self.pos: + self.ledges += neighbour_ref.ledges + neighbour_ref.reference = self + self.ledges -= 1 + else: + neighbour_ref.ledges -= 1 + if neighbour_ref.ledges == 0: + neighbour.remove(neighbour_ref) + self.board.zobrist.add() + + def remove(self, reference, update=True): + self.board.zobrist.update(self, EMPTY) + self.removestamp = TIMESTAMP + if update: + self.color = EMPTY + self.board.emptyset.add(self.pos) +# if color == BLACK: +# self.board.black_dead += 1 +# else: +# self.board.white_dead += 1 + for neighbour in self.neighbours: + if neighbour.color != EMPTY and neighbour.removestamp != TIMESTAMP: + neighbour_ref = neighbour.find(update) + if neighbour_ref.pos == reference.pos: + neighbour.remove(reference, update) + else: + if update: + neighbour_ref.ledges += 1 + + def find(self, update=False): + reference = self.reference + if reference.pos != self.pos: + reference = reference.find(update) + if update: + self.reference = reference + return reference + + def __repr__(self): + return repr(to_xy(self.pos)) + + +class EmptySet: + + def __init__(self, board): + self.board = board + self.empties = list(range(SIZE * SIZE)) + self.empty_pos = list(range(SIZE * SIZE)) + + def random_choice(self): + choices = len(self.empties) + while choices: + i = int(random.random() * choices) + pos = self.empties[i] + if self.board.useful(pos): + return pos + choices -= 1 + self.set(i, self.empties[choices]) + self.set(choices, pos) + return PASS + + def add(self, pos): + self.empty_pos[pos] = len(self.empties) + self.empties.append(pos) + + def remove(self, pos): + self.set(self.empty_pos[pos], self.empties[len(self.empties) - 1]) + self.empties.pop() + + def set(self, i, pos): + self.empties[i] = pos + self.empty_pos[pos] = i + + +class ZobristHash: + + def __init__(self, board): + self.board = board + self.hash_set = set() + self.hash = 0 + for square in self.board.squares: + self.hash ^= square.zobrist_strings[EMPTY] + self.hash_set.clear() + self.hash_set.add(self.hash) + + def update(self, square, color): + self.hash ^= square.zobrist_strings[square.color] + self.hash ^= square.zobrist_strings[color] + + def add(self): + self.hash_set.add(self.hash) + + def dupe(self): + return self.hash in self.hash_set + + +class Board: + + def __init__(self): + self.squares = [Square(self, pos) for pos in range(SIZE * SIZE)] + for square in self.squares: + square.set_neighbours() + self.reset() + + def reset(self): + for square in self.squares: + square.color = EMPTY + square.used = False + self.emptyset = EmptySet(self) + self.zobrist = ZobristHash(self) + self.color = BLACK + self.finished = False + self.lastmove = -2 + self.history = [] + self.white_dead = 0 + self.black_dead = 0 + + def move(self, pos): + square = self.squares[pos] + if pos != PASS: + square.move(self.color) + self.emptyset.remove(square.pos) + elif self.lastmove == PASS: + self.finished = True + if self.color == BLACK: + self.color = WHITE + else: + self.color = BLACK + self.lastmove = pos + self.history.append(pos) + + def random_move(self): + return self.emptyset.random_choice() + + def useful_fast(self, square): + if not square.used: + for neighbour in square.neighbours: + if neighbour.color == EMPTY: + return True + return False + + def useful(self, pos): + global TIMESTAMP + TIMESTAMP += 1 + square = self.squares[pos] + if self.useful_fast(square): + return True + old_hash = self.zobrist.hash + self.zobrist.update(square, self.color) + empties = opps = weak_opps = neighs = weak_neighs = 0 + for neighbour in square.neighbours: + neighcolor = neighbour.color + if neighcolor == EMPTY: + empties += 1 + continue + neighbour_ref = neighbour.find() + if neighbour_ref.timestamp != TIMESTAMP: + if neighcolor == self.color: + neighs += 1 + else: + opps += 1 + neighbour_ref.timestamp = TIMESTAMP + neighbour_ref.temp_ledges = neighbour_ref.ledges + neighbour_ref.temp_ledges -= 1 + if neighbour_ref.temp_ledges == 0: + if neighcolor == self.color: + weak_neighs += 1 + else: + weak_opps += 1 + neighbour_ref.remove(neighbour_ref, update=False) + dupe = self.zobrist.dupe() + self.zobrist.hash = old_hash + strong_neighs = neighs - weak_neighs + strong_opps = opps - weak_opps + return not dupe and \ + (empties or weak_opps or (strong_neighs and (strong_opps or weak_neighs))) + + def useful_moves(self): + return [pos for pos in self.emptyset.empties if self.useful(pos)] + + def replay(self, history): + for pos in history: + self.move(pos) + + def score(self, color): + if color == WHITE: + count = KOMI + self.black_dead + else: + count = self.white_dead + for square in self.squares: + squarecolor = square.color + if squarecolor == color: + count += 1 + elif squarecolor == EMPTY: + surround = 0 + for neighbour in square.neighbours: + if neighbour.color == color: + surround += 1 + if surround == len(square.neighbours): + count += 1 + return count + + def check(self): + for square in self.squares: + if square.color == EMPTY: + continue + + members1 = set([square]) + changed = True + while changed: + changed = False + for member in members1.copy(): + for neighbour in member.neighbours: + if neighbour.color == square.color and neighbour not in members1: + changed = True + members1.add(neighbour) + ledges1 = 0 + for member in members1: + for neighbour in member.neighbours: + if neighbour.color == EMPTY: + ledges1 += 1 + + root = square.find() + + # print 'members1', square, root, members1 + # print 'ledges1', square, ledges1 + + members2 = set() + for square2 in self.squares: + if square2.color != EMPTY and square2.find() == root: + members2.add(square2) + + ledges2 = root.ledges + # print 'members2', square, root, members1 + # print 'ledges2', square, ledges2 + + assert members1 == members2 + assert ledges1 == ledges2, ('ledges differ at %r: %d %d' % ( + square, ledges1, ledges2)) + + set(self.emptyset.empties) + + empties2 = set() + for square in self.squares: + if square.color == EMPTY: + empties2.add(square.pos) + + def __repr__(self): + result = [] + for y in range(SIZE): + start = to_pos(0, y) + result.append(''.join( + [SHOW[square.color] + ' ' for square in self.squares[start:start + SIZE]])) + return '\n'.join(result) + + +class UCTNode: + + def __init__(self): + self.bestchild = None + self.pos = -1 + self.wins = 0 + self.losses = 0 + self.pos_child = [None for x in range(SIZE * SIZE)] + self.parent = None + + def play(self, board): + """ uct tree search """ + color = board.color + node = self + path = [node] + while True: + pos = node.select(board) + if pos == PASS: + break + board.move(pos) + child = node.pos_child[pos] + if not child: + child = node.pos_child[pos] = UCTNode() + child.unexplored = board.useful_moves() + child.pos = pos + child.parent = node + path.append(child) + break + path.append(child) + node = child + self.random_playout(board) + self.update_path(board, color, path) + + def select(self, board): + """ select move; unexplored children first, then according to uct value """ + if self.unexplored: + i = random.randrange(len(self.unexplored)) + pos = self.unexplored[i] + self.unexplored[i] = self.unexplored[len(self.unexplored) - 1] + self.unexplored.pop() + return pos + elif self.bestchild: + return self.bestchild.pos + else: + return PASS + + def random_playout(self, board): + """ random play until both players pass """ + for x in range(MAXMOVES): # XXX while not self.finished? + if board.finished: + break + board.move(board.random_move()) + + def update_path(self, board, color, path): + """ update win/loss count along path """ + wins = board.score(BLACK) >= board.score(WHITE) + for node in path: + if color == BLACK: + color = WHITE + else: + color = BLACK + if wins == (color == BLACK): + node.wins += 1 + else: + node.losses += 1 + if node.parent: + node.parent.bestchild = node.parent.best_child() + + def score(self): + winrate = self.wins / float(self.wins + self.losses) + parentvisits = self.parent.wins + self.parent.losses + if not parentvisits: + return winrate + nodevisits = self.wins + self.losses + return winrate + math.sqrt((math.log(parentvisits)) / (5 * nodevisits)) + + def best_child(self): + maxscore = -1 + maxchild = None + for child in self.pos_child: + if child and child.score() > maxscore: + maxchild = child + maxscore = child.score() + return maxchild + + def best_visited(self): + maxvisits = -1 + maxchild = None + for child in self.pos_child: + # if child: + # print to_xy(child.pos), child.wins, child.losses, child.score() + if child and (child.wins + child.losses) > maxvisits: + maxvisits, maxchild = (child.wins + child.losses), child + return maxchild + + +# def user_move(board): +# while True: +# text = input('?').strip() +# if text == 'p': +# return PASS +# if text == 'q': +# raise EOFError +# try: +# x, y = [int(i) for i in text.split()] +# except ValueError: +# continue +# if not (0 <= x < SIZE and 0 <= y < SIZE): +# continue +# pos = to_pos(x, y) +# if board.useful(pos): +# return pos + + +def computer_move(board): + pos = board.random_move() + if pos == PASS: + return PASS + tree = UCTNode() + tree.unexplored = board.useful_moves() + nboard = Board() + for game in range(GAMES): + node = tree + nboard.reset() + nboard.replay(board.history) + node.play(nboard) + return tree.best_visited().pos + + +def versus_cpu(): + random.seed(1) + board = Board() + return computer_move(board) + + +def run(): + versus_cpu() + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/hexiom.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/hexiom.py new file mode 100644 index 0000000000..596f0876a3 --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/hexiom.py @@ -0,0 +1,673 @@ +""" +Solver of Hexiom board game. + +Benchmark from Laurent Vaucher. + +Source: https://github.com/slowfrog/hexiom : hexiom2.py, level36.txt + +(Main function tweaked by Armin Rigo.) +""" + +import io +import argparse + +# 2016-07-07: CPython 3.6 takes ~25 ms to solve the board level 25 +DEFAULT_LEVEL = 25 + + +################################## +class Dir(object): + + def __init__(self, x, y): + self.x = x + self.y = y + + +DIRS = [Dir(1, 0), + Dir(-1, 0), + Dir(0, 1), + Dir(0, -1), + Dir(1, 1), + Dir(-1, -1)] + +EMPTY = 7 + +################################## + + +class Done(object): + MIN_CHOICE_STRATEGY = 0 + MAX_CHOICE_STRATEGY = 1 + HIGHEST_VALUE_STRATEGY = 2 + FIRST_STRATEGY = 3 + MAX_NEIGHBORS_STRATEGY = 4 + MIN_NEIGHBORS_STRATEGY = 5 + + def __init__(self, count, empty=False): + self.count = count + self.cells = None if empty else [ + [0, 1, 2, 3, 4, 5, 6, EMPTY] for i in range(count)] + + def clone(self): + ret = Done(self.count, True) + ret.cells = [self.cells[i][:] for i in range(self.count)] + return ret + + def __getitem__(self, i): + return self.cells[i] + + def set_done(self, i, v): + self.cells[i] = [v] + + def already_done(self, i): + return len(self.cells[i]) == 1 + + def remove(self, i, v): + if v in self.cells[i]: + self.cells[i].remove(v) + return True + else: + return False + + def remove_all(self, v): + for i in range(self.count): + self.remove(i, v) + + def remove_unfixed(self, v): + changed = False + for i in range(self.count): + if not self.already_done(i): + if self.remove(i, v): + changed = True + return changed + + def filter_tiles(self, tiles): + for v in range(8): + if tiles[v] == 0: + self.remove_all(v) + + def next_cell_min_choice(self): + minlen = 10 + mini = -1 + for i in range(self.count): + if 1 < len(self.cells[i]) < minlen: + minlen = len(self.cells[i]) + mini = i + return mini + + def next_cell_max_choice(self): + maxlen = 1 + maxi = -1 + for i in range(self.count): + if maxlen < len(self.cells[i]): + maxlen = len(self.cells[i]) + maxi = i + return maxi + + def next_cell_highest_value(self): + maxval = -1 + maxi = -1 + for i in range(self.count): + if (not self.already_done(i)): + maxvali = max(k for k in self.cells[i] if k != EMPTY) + if maxval < maxvali: + maxval = maxvali + maxi = i + return maxi + + def next_cell_first(self): + for i in range(self.count): + if (not self.already_done(i)): + return i + return -1 + + def next_cell_max_neighbors(self, pos): + maxn = -1 + maxi = -1 + for i in range(self.count): + if not self.already_done(i): + cells_around = pos.hex.get_by_id(i).links + n = sum(1 if (self.already_done(nid) and (self[nid][0] != EMPTY)) else 0 + for nid in cells_around) + if n > maxn: + maxn = n + maxi = i + return maxi + + def next_cell_min_neighbors(self, pos): + minn = 7 + mini = -1 + for i in range(self.count): + if not self.already_done(i): + cells_around = pos.hex.get_by_id(i).links + n = sum(1 if (self.already_done(nid) and (self[nid][0] != EMPTY)) else 0 + for nid in cells_around) + if n < minn: + minn = n + mini = i + return mini + + def next_cell(self, pos, strategy=HIGHEST_VALUE_STRATEGY): + if strategy == Done.HIGHEST_VALUE_STRATEGY: + return self.next_cell_highest_value() + elif strategy == Done.MIN_CHOICE_STRATEGY: + return self.next_cell_min_choice() + elif strategy == Done.MAX_CHOICE_STRATEGY: + return self.next_cell_max_choice() + elif strategy == Done.FIRST_STRATEGY: + return self.next_cell_first() + elif strategy == Done.MAX_NEIGHBORS_STRATEGY: + return self.next_cell_max_neighbors(pos) + elif strategy == Done.MIN_NEIGHBORS_STRATEGY: + return self.next_cell_min_neighbors(pos) + else: + raise Exception("Wrong strategy: %d" % strategy) + +################################## + + +class Node(object): + + def __init__(self, pos, id, links): + self.pos = pos + self.id = id + self.links = links + +################################## + + +class Hex(object): + + def __init__(self, size): + self.size = size + self.count = 3 * size * (size - 1) + 1 + self.nodes_by_id = self.count * [None] + self.nodes_by_pos = {} + id = 0 + for y in range(size): + for x in range(size + y): + pos = (x, y) + node = Node(pos, id, []) + self.nodes_by_pos[pos] = node + self.nodes_by_id[node.id] = node + id += 1 + for y in range(1, size): + for x in range(y, size * 2 - 1): + ry = size + y - 1 + pos = (x, ry) + node = Node(pos, id, []) + self.nodes_by_pos[pos] = node + self.nodes_by_id[node.id] = node + id += 1 + + def link_nodes(self): + for node in self.nodes_by_id: + (x, y) = node.pos + for dir in DIRS: + nx = x + dir.x + ny = y + dir.y + if self.contains_pos((nx, ny)): + node.links.append(self.nodes_by_pos[(nx, ny)].id) + + def contains_pos(self, pos): + return pos in self.nodes_by_pos + + def get_by_pos(self, pos): + return self.nodes_by_pos[pos] + + def get_by_id(self, id): + return self.nodes_by_id[id] + + +################################## +class Pos(object): + + def __init__(self, hex, tiles, done=None): + self.hex = hex + self.tiles = tiles + self.done = Done(hex.count) if done is None else done + + def clone(self): + return Pos(self.hex, self.tiles, self.done.clone()) + +################################## + + +def constraint_pass(pos, last_move=None): + changed = False + left = pos.tiles[:] + done = pos.done + + # Remove impossible values from free cells + free_cells = (range(done.count) if last_move is None + else pos.hex.get_by_id(last_move).links) + for i in free_cells: + if not done.already_done(i): + vmax = 0 + vmin = 0 + cells_around = pos.hex.get_by_id(i).links + for nid in cells_around: + if done.already_done(nid): + if done[nid][0] != EMPTY: + vmin += 1 + vmax += 1 + else: + vmax += 1 + + for num in range(7): + if (num < vmin) or (num > vmax): + if done.remove(i, num): + changed = True + + # Computes how many of each value is still free + for cell in done.cells: + if len(cell) == 1: + left[cell[0]] -= 1 + + for v in range(8): + # If there is none, remove the possibility from all tiles + if (pos.tiles[v] > 0) and (left[v] == 0): + if done.remove_unfixed(v): + changed = True + else: + possible = sum((1 if v in cell else 0) for cell in done.cells) + # If the number of possible cells for a value is exactly the number of available tiles + # put a tile in each cell + if pos.tiles[v] == possible: + for i in range(done.count): + cell = done.cells[i] + if (not done.already_done(i)) and (v in cell): + done.set_done(i, v) + changed = True + + # Force empty or non-empty around filled cells + filled_cells = (range(done.count) if last_move is None + else [last_move]) + for i in filled_cells: + if done.already_done(i): + num = done[i][0] + empties = 0 + filled = 0 + unknown = [] + cells_around = pos.hex.get_by_id(i).links + for nid in cells_around: + if done.already_done(nid): + if done[nid][0] == EMPTY: + empties += 1 + else: + filled += 1 + else: + unknown.append(nid) + if len(unknown) > 0: + if num == filled: + for u in unknown: + if EMPTY in done[u]: + done.set_done(u, EMPTY) + changed = True + # else: + # raise Exception("Houston, we've got a problem") + elif num == filled + len(unknown): + for u in unknown: + if done.remove(u, EMPTY): + changed = True + + return changed + + +ASCENDING = 1 +DESCENDING = -1 + + +def find_moves(pos, strategy, order): + done = pos.done + cell_id = done.next_cell(pos, strategy) + if cell_id < 0: + return [] + + if order == ASCENDING: + return [(cell_id, v) for v in done[cell_id]] + else: + # Try higher values first and EMPTY last + moves = list(reversed([(cell_id, v) + for v in done[cell_id] if v != EMPTY])) + if EMPTY in done[cell_id]: + moves.append((cell_id, EMPTY)) + return moves + + +def play_move(pos, move): + (cell_id, i) = move + pos.done.set_done(cell_id, i) + + +def print_pos(pos, output): + hex = pos.hex + done = pos.done + size = hex.size + for y in range(size): + print(" " * (size - y - 1), end="", file=output) + for x in range(size + y): + pos2 = (x, y) + id = hex.get_by_pos(pos2).id + if done.already_done(id): + c = str(done[id][0]) if done[id][0] != EMPTY else "." + else: + c = "?" + print("%s " % c, end="", file=output) + print(end="\n", file=output) + for y in range(1, size): + print(" " * y, end="", file=output) + for x in range(y, size * 2 - 1): + ry = size + y - 1 + pos2 = (x, ry) + id = hex.get_by_pos(pos2).id + if done.already_done(id): + c = str(done[id][0]) if done[id][0] != EMPTY else "." + else: + c = "?" + print("%s " % c, end="", file=output) + print(end="\n", file=output) + + +OPEN = 0 +SOLVED = 1 +IMPOSSIBLE = -1 + + +def solved(pos, output, verbose=False): + hex = pos.hex + tiles = pos.tiles[:] + done = pos.done + exact = True + all_done = True + for i in range(hex.count): + if len(done[i]) == 0: + return IMPOSSIBLE + elif done.already_done(i): + num = done[i][0] + tiles[num] -= 1 + if (tiles[num] < 0): + return IMPOSSIBLE + vmax = 0 + vmin = 0 + if num != EMPTY: + cells_around = hex.get_by_id(i).links + for nid in cells_around: + if done.already_done(nid): + if done[nid][0] != EMPTY: + vmin += 1 + vmax += 1 + else: + vmax += 1 + + if (num < vmin) or (num > vmax): + return IMPOSSIBLE + if num != vmin: + exact = False + else: + all_done = False + + if (not all_done) or (not exact): + return OPEN + + print_pos(pos, output) + return SOLVED + + +def solve_step(prev, strategy, order, output, first=False): + if first: + pos = prev.clone() + while constraint_pass(pos): + pass + else: + pos = prev + + moves = find_moves(pos, strategy, order) + if len(moves) == 0: + return solved(pos, output) + else: + for move in moves: + # print("Trying (%d, %d)" % (move[0], move[1])) + ret = OPEN + new_pos = pos.clone() + play_move(new_pos, move) + # print_pos(new_pos) + while constraint_pass(new_pos, move[0]): + pass + cur_status = solved(new_pos, output) + if cur_status != OPEN: + ret = cur_status + else: + ret = solve_step(new_pos, strategy, order, output) + if ret == SOLVED: + return SOLVED + return IMPOSSIBLE + + +def check_valid(pos): + hex = pos.hex + tiles = pos.tiles + # fill missing entries in tiles + tot = 0 + for i in range(8): + if tiles[i] > 0: + tot += tiles[i] + else: + tiles[i] = 0 + # check total + if tot != hex.count: + raise Exception( + "Invalid input. Expected %d tiles, got %d." % (hex.count, tot)) + + +def solve(pos, strategy, order, output): + check_valid(pos) + return solve_step(pos, strategy, order, output, first=True) + + +# TODO Write an 'iterator' to go over all x,y positions + +def read_file(file): + lines = [line.strip("\r\n") for line in file.splitlines()] + size = int(lines[0]) + hex = Hex(size) + linei = 1 + tiles = 8 * [0] + done = Done(hex.count) + for y in range(size): + line = lines[linei][size - y - 1:] + p = 0 + for x in range(size + y): + tile = line[p:p + 2] + p += 2 + if tile[1] == ".": + inctile = EMPTY + else: + inctile = int(tile) + tiles[inctile] += 1 + # Look for locked tiles + if tile[0] == "+": + # print("Adding locked tile: %d at pos %d, %d, id=%d" % + # (inctile, x, y, hex.get_by_pos((x, y)).id)) + done.set_done(hex.get_by_pos((x, y)).id, inctile) + + linei += 1 + for y in range(1, size): + ry = size - 1 + y + line = lines[linei][y:] + p = 0 + for x in range(y, size * 2 - 1): + tile = line[p:p + 2] + p += 2 + if tile[1] == ".": + inctile = EMPTY + else: + inctile = int(tile) + tiles[inctile] += 1 + # Look for locked tiles + if tile[0] == "+": + # print("Adding locked tile: %d at pos %d, %d, id=%d" % + # (inctile, x, ry, hex.get_by_pos((x, ry)).id)) + done.set_done(hex.get_by_pos((x, ry)).id, inctile) + linei += 1 + hex.link_nodes() + done.filter_tiles(tiles) + return Pos(hex, tiles, done) + + +def solve_file(file, strategy, order, output): + pos = read_file(file) + solve(pos, strategy, order, output) + + +LEVELS = {} + +LEVELS[2] = (""" +2 + . 1 + . 1 1 + 1 . +""", """\ + 1 1 +. . . + 1 1 +""") + +LEVELS[10] = (""" +3 + +.+. . + +. 0 . 2 + . 1+2 1 . + 2 . 0+. + .+.+. +""", """\ + . . 1 + . 1 . 2 +0 . 2 2 . + . . . . + 0 . . +""") + +LEVELS[20] = (""" +3 + . 5 4 + . 2+.+1 + . 3+2 3 . + +2+. 5 . + . 3 . +""", """\ + 3 3 2 + 4 5 . 1 +3 5 2 . . + 2 . . . + . . . +""") + +LEVELS[25] = (""" +3 + 4 . . + . . 2 . + 4 3 2 . 4 + 2 2 3 . + 4 2 4 +""", """\ + 3 4 2 + 2 4 4 . +. . . 4 2 + . 2 4 3 + . 2 . +""") + +LEVELS[30] = (""" +4 + 5 5 . . + 3 . 2+2 6 + 3 . 2 . 5 . + . 3 3+4 4 . 3 + 4 5 4 . 5 4 + 5+2 . . 3 + 4 . . . +""", """\ + 3 4 3 . + 4 6 5 2 . + 2 5 5 . . 2 +. . 5 4 . 4 3 + . 3 5 4 5 4 + . 2 . 3 3 + . . . . +""") + +LEVELS[36] = (""" +4 + 2 1 1 2 + 3 3 3 . . + 2 3 3 . 4 . + . 2 . 2 4 3 2 + 2 2 . . . 2 + 4 3 4 . . + 3 2 3 3 +""", """\ + 3 4 3 2 + 3 4 4 . 3 + 2 . . 3 4 3 +2 . 1 . 3 . 2 + 3 3 . 2 . 2 + 3 . 2 . 2 + 2 2 . 1 +""") + + +def __benchmark__(loops, level): + board, solution = LEVELS[level] + order = DESCENDING + strategy = Done.FIRST_STRATEGY + stream = io.StringIO() + + board = board.strip() + expected = solution.rstrip() + + range_it = range(loops) + + for _ in range_it: + stream = io.StringIO() + solve_file(board, strategy, order, stream) + output = stream.getvalue() + stream = None + + output = '\n'.join(line.rstrip() for line in output.splitlines()) + if output != expected: + raise AssertionError("got a wrong answer:\n%s\nexpected: %s" + % (output, expected)) + + +def add_cmdline_args(cmd, args): + cmd.extend(("--level", str(args.level))) + + +def run(): + levels = sorted(LEVELS) + parser = argparse.ArgumentParser(prog="python") + parser.add_argument("--level", type=int, + choices=levels, + default=DEFAULT_LEVEL, + help="Hexiom board level (default: %s)" + % DEFAULT_LEVEL) + + args = parser.parse_args() + __benchmark__(16, args.level) + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/json_dumps.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/json_dumps.py new file mode 100644 index 0000000000..40c514703e --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/json_dumps.py @@ -0,0 +1,69 @@ +import json +import sys +import argparse + + +EMPTY = ({}, 2000) +SIMPLE_DATA = {'key1': 0, 'key2': True, 'key3': 'value', 'key4': 'foo', + 'key5': 'string'} +SIMPLE = (SIMPLE_DATA, 1000) +NESTED_DATA = {'key1': 0, 'key2': SIMPLE[0], 'key3': 'value', 'key4': SIMPLE[0], + 'key5': SIMPLE[0], 'key': '\u0105\u0107\u017c'} +NESTED = (NESTED_DATA, 1000) +HUGE = ([NESTED[0]] * 1000, 1) + +CASES = ['EMPTY', 'SIMPLE', 'NESTED', 'HUGE'] + + +def bench_json_dumps(data): + for obj, count_it in data: + for _ in count_it: + json.dumps(obj) + + +def add_cmdline_args(cmd, args): + if args.cases: + cmd.extend(("--cases", args.cases)) + + +def run(): + parser = argparse.ArgumentParser(prog="python") + parser.add_argument("--cases", + help="Comma separated list of cases. Available cases: %s. By default, run all cases." + % ', '.join(CASES)) + + args = parser.parse_args() + if args.cases: + cases = [] + for case in args.cases.split(','): + case = case.strip() + if case: + cases.append(case) + if not cases: + print("ERROR: empty list of cases") + sys.exit(1) + else: + cases = CASES + + data = [] + for case in cases: + obj, count = globals()[case] + data.append((obj, range(count))) + + bench_json_dumps(data) + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/json_loads.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/json_loads.py new file mode 100644 index 0000000000..be37c1e169 --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/json_loads.py @@ -0,0 +1,115 @@ + +"""Script for testing the performance of json parsing and serialization. + +This will dump/load several real world-representative objects a few +thousand times. The methodology below was chosen for was chosen to be similar +to real-world scenarios which operate on single objects at a time. +""" + +# Python imports +import json +import random +import sys + + +DICT = { + 'ads_flags': 0, + 'age': 18, + 'bulletin_count': 0, + 'comment_count': 0, + 'country': 'BR', + 'encrypted_id': 'G9urXXAJwjE', + 'favorite_count': 9, + 'first_name': '', + 'flags': 412317970704, + 'friend_count': 0, + 'gender': 'm', + 'gender_for_display': 'Male', + 'id': 302935349, + 'is_custom_profile_icon': 0, + 'last_name': '', + 'locale_preference': 'pt_BR', + 'member': 0, + 'tags': ['a', 'b', 'c', 'd', 'e', 'f', 'g'], + 'profile_foo_id': 827119638, + 'secure_encrypted_id': 'Z_xxx2dYx3t4YAdnmfgyKw', + 'session_number': 2, + 'signup_id': '201-19225-223', + 'status': 'A', + 'theme': 1, + 'time_created': 1225237014, + 'time_updated': 1233134493, + 'unread_message_count': 0, + 'user_group': '0', + 'username': 'collinwinter', + 'play_count': 9, + 'view_count': 7, + 'zip': ''} + +TUPLE = ( + [265867233, 265868503, 265252341, 265243910, 265879514, + 266219766, 266021701, 265843726, 265592821, 265246784, + 265853180, 45526486, 265463699, 265848143, 265863062, + 265392591, 265877490, 265823665, 265828884, 265753032], 60) + + +def mutate_dict(orig_dict, random_source): + new_dict = dict(orig_dict) + for key, value in new_dict.items(): + rand_val = random_source.random() * sys.maxsize + if isinstance(key, (int, bytes, str)): + new_dict[key] = type(key)(rand_val) + return new_dict + + +random_source = random.Random(5) # Fixed seed. +DICT_GROUP = [mutate_dict(DICT, random_source) for _ in range(3)] + + +def bench_json_loads(objs): + for obj in objs: + # 20 loads + json.loads(obj) + json.loads(obj) + json.loads(obj) + json.loads(obj) + json.loads(obj) + json.loads(obj) + json.loads(obj) + json.loads(obj) + json.loads(obj) + json.loads(obj) + json.loads(obj) + json.loads(obj) + json.loads(obj) + json.loads(obj) + json.loads(obj) + json.loads(obj) + json.loads(obj) + json.loads(obj) + json.loads(obj) + json.loads(obj) + + +def run(): + json_dict = json.dumps(DICT) + json_tuple = json.dumps(TUPLE) + json_dict_group = json.dumps(DICT_GROUP) + objs = (json_dict, json_tuple, json_dict_group) + bench_json_loads(objs) + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/meteor_contest.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/meteor_contest.py new file mode 100644 index 0000000000..ec8be6098b --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/meteor_contest.py @@ -0,0 +1,231 @@ +""" +Meteor Puzzle board: +http://benchmarksgame.alioth.debian.org/u32/meteor-description.html#meteor + +The Computer Language Benchmarks Game +http://benchmarksgame.alioth.debian.org/ + +contributed by Daniel Nanz, 2008-08-21 +""" + +from bisect import bisect + + +SOLVE_ARG = 60 + +WIDTH, HEIGHT = 5, 10 +DIR_NO = 6 +S, E = WIDTH * HEIGHT, 2 +SE = S + (E / 2) +SW = SE - E +W, NW, NE = -E, -SE, -SW + +SOLUTIONS = [ + '00001222012661126155865558633348893448934747977799', + '00001222012771127148774485464855968596835966399333', + '00001222012771127148774485494855998596835966366333', + '00001222012771127148774485994855948596835966366333', + '00001222012771127166773863384653846538445584959999', + '00001222012771127183778834833348555446554666969999', + '00001222012771127183778834833348555446554966699996', + '00001223012331123166423564455647456775887888979999', + '00001555015541144177484726877268222683336689399993', + '00001555015541144177484728677286222863338669399993', + '00001599015591159148594482224827748276837766366333', + '00001777017871184155845558449984669662932629322333', + '00004222042664426774996879687759811598315583153331', + '00004222042774427384773183331866118615586555969999', + '00004223042334423784523785771855718566186611969999', + '00004227042874428774528735833155831566316691169999', + '00004333045534455384175781777812228116286662969999', + '00004333045934459384559185991866118612286727267772', + '00004333047734427384277182221866118615586555969999', + '00004555045514411224172621768277368736683339899998', + '00004555045514411224172721777299998966836688368333', + '00004555045534413334132221177266172677886888969999', + '00004555045534473334739967792617926192661882211888', + '00004555045564466694699992288828811233317273177731', + '00004555045564466694699997773172731233312881122888', + '00004555045564496664999962288828811233317273177731', + '00004555045564496664999967773172731233312881122888', + '00004555045584411884171187722866792679236992369333', + '00004555045584411884191189999832226333267372677766', + '00004555045584411884191189999866222623336727367773', + '13335138551389511895778697869947762446624022240000', + '13777137271333211882888226999946669446554055540000', + '13777137271333211882888229999649666446554055540000', + '27776272768221681166819958195548395443954033340000', + '33322392623926696648994485554855148117871077710000', + '33366366773867284772842228449584195119551099510000', + '33366366953869584955849958447784172117721022210000', + '33366366953869589955849458447784172117721022210000', + '33386388663866989999277712727142211441554055540000', + '33396329963297629766822778117148811448554055540000', + '33399366953869586955846458447784172117721022210000', + '37776372763332622266899998119148811448554055540000', + '39999396683336822268277682748477144114551055510000', + '39999398663338622286277862748477144114551055510000', + '66777627376233362223899998119148811448554055540000', + '69999666945564455584333843887738172117721022210000', + '88811228816629162971629776993743337443554055540000', + '88822118821333213727137776999946669446554055540000', + '88822118821333213727137779999649666446554055540000', + '89999893338663786377286712627142211441554055540000', + '99777974743984439884333685556855162116621022210000', + '99995948554483564835648336837766172117721022210000', + '99996119661366513855133853782547782447824072240000', + '99996911668166581755817758732548732443324032240000', + '99996926668261182221877718757148355443554033340000', + '99996955568551681166812228177248372443774033340000', + '99996955568551681166813338137748372447724022240000', + '99996966645564455584333843887738172117721022210000', + '99996988868877627166277112223143331443554055540000', + '99997988878857765474655446532466132113321032210000'] + + +def rotate(ido, rd={E: NE, NE: NW, NW: W, W: SW, SW: SE, SE: E}): + return [rd[o] for o in ido] + + +def flip(ido, fd={E: E, NE: SE, NW: SW, W: W, SW: NW, SE: NE}): + return [fd[o] for o in ido] + + +def permute(ido, r_ido, rotate=rotate, flip=flip): + ps = [ido] + for r in range(DIR_NO - 1): + ps.append(rotate(ps[-1])) + if ido == r_ido: # C2-symmetry + ps = ps[0:DIR_NO // 2] + for pp in ps[:]: + ps.append(flip(pp)) + return ps + + +def convert(ido): + '''incremental direction offsets -> "coordinate offsets" ''' + out = [0] + for o in ido: + out.append(out[-1] + o) + return list(set(out)) + + +def get_footprints(board, cti, pieces): + fps = [[[] for p in range(len(pieces))] for ci in range(len(board))] + for c in board: + for pi, p in enumerate(pieces): + for pp in p: + fp = frozenset([cti[c + o] for o in pp if (c + o) in cti]) + if len(fp) == 5: + fps[min(fp)][pi].append(fp) + return fps + + +def get_senh(board, cti): + '''-> south-east neighborhood''' + se_nh = [] + nh = [E, SW, SE] + for c in board: + se_nh.append(frozenset([cti[c + o] for o in nh if (c + o) in cti])) + return se_nh + + +def get_puzzle(width, height): + board = [E * x + S * y + (y % 2) + for y in range(height) + for x in range(width)] + cti = dict((board[i], i) for i in range(len(board))) + + # Incremental direction offsets + idos = [[E, E, E, SE], + [SE, SW, W, SW], + [W, W, SW, SE], + [E, E, SW, SE], + [NW, W, NW, SE, SW], + [E, E, NE, W], + [NW, NE, NE, W], + [NE, SE, E, NE], + [SE, SE, E, SE], + [E, NW, NW, NW]] + + # Restrict piece 4 + perms = (permute(p, idos[3]) for p in idos) + pieces = [[convert(pp) for pp in p] for p in perms] + return (board, cti, pieces) + + +def solve(n, i_min, free, curr_board, pieces_left, solutions, fps, se_nh, + # Hack to use a fast local variable to avoid a global lookup + bisect=bisect): + + fp_i_cands = fps[i_min] + for p in pieces_left: + fp_cands = fp_i_cands[p] + for fp in fp_cands: + if fp <= free: + n_curr_board = curr_board[:] + for ci in fp: + n_curr_board[ci] = p + + if len(pieces_left) > 1: + n_free = free - fp + n_i_min = min(n_free) + if len(n_free & se_nh[n_i_min]) > 0: + n_pieces_left = pieces_left[:] + n_pieces_left.remove(p) + solve(n, n_i_min, n_free, n_curr_board, + n_pieces_left, solutions, fps, se_nh) + else: + s = ''.join(map(str, n_curr_board)) + solutions.insert(bisect(solutions, s), s) + rs = s[::-1] + solutions.insert(bisect(solutions, rs), rs) + if len(solutions) >= n: + return + + if len(solutions) >= n: + return + + +def bench_meteor_contest(loops, board, pieces, solve_arg, fps, se_nh): + range_it = range(loops) + + for _ in range_it: + free = frozenset(range(len(board))) + curr_board = [-1] * len(board) + pieces_left = list(range(len(pieces))) + solutions = [] + solve(solve_arg, 0, free, curr_board, pieces_left, + solutions, fps, se_nh) + + if solutions != SOLUTIONS: + raise ValueError("unexpected solutions") + + +def __benchmark__(): + board, cti, pieces = get_puzzle(WIDTH, HEIGHT) + fps = get_footprints(board, cti, pieces) + se_nh = get_senh(board, cti) + + solve_arg = SOLVE_ARG + bench_meteor_contest(1, board, pieces, solve_arg, fps, se_nh) + + +def run(): + __benchmark__() + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/nbody.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/nbody.py new file mode 100644 index 0000000000..f25816e09d --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/nbody.py @@ -0,0 +1,167 @@ +""" +N-body benchmark from the Computer Language Benchmarks Game. + +This is intended to support Unladen Swallow's pyperf.py. Accordingly, it has been +modified from the Shootout version: +- Accept standard Unladen Swallow benchmark options. +- Run report_energy()/advance() in a loop. +- Reimplement itertools.combinations() to work with older Python versions. + +Pulled from: +http://benchmarksgame.alioth.debian.org/u64q/program.php?test=nbody&lang=python3&id=1 + +Contributed by Kevin Carson. +Modified by Tupteq, Fredrik Johansson, and Daniel Nanz. +""" + +import argparse + +__contact__ = "collinwinter@google.com (Collin Winter)" +DEFAULT_ITERATIONS = 20000 +DEFAULT_REFERENCE = 'sun' + + +def combinations(l): + """Pure-Python implementation of itertools.combinations(l, 2).""" + result = [] + for x in range(len(l) - 1): + ls = l[x + 1:] + for y in ls: + result.append((l[x], y)) + return result + + +PI = 3.14159265358979323 +SOLAR_MASS = 4 * PI * PI +DAYS_PER_YEAR = 365.24 + +BODIES = { + 'sun': ([0.0, 0.0, 0.0], [0.0, 0.0, 0.0], SOLAR_MASS), + + 'jupiter': ([4.84143144246472090e+00, + -1.16032004402742839e+00, + -1.03622044471123109e-01], + [1.66007664274403694e-03 * DAYS_PER_YEAR, + 7.69901118419740425e-03 * DAYS_PER_YEAR, + -6.90460016972063023e-05 * DAYS_PER_YEAR], + 9.54791938424326609e-04 * SOLAR_MASS), + + 'saturn': ([8.34336671824457987e+00, + 4.12479856412430479e+00, + -4.03523417114321381e-01], + [-2.76742510726862411e-03 * DAYS_PER_YEAR, + 4.99852801234917238e-03 * DAYS_PER_YEAR, + 2.30417297573763929e-05 * DAYS_PER_YEAR], + 2.85885980666130812e-04 * SOLAR_MASS), + + 'uranus': ([1.28943695621391310e+01, + -1.51111514016986312e+01, + -2.23307578892655734e-01], + [2.96460137564761618e-03 * DAYS_PER_YEAR, + 2.37847173959480950e-03 * DAYS_PER_YEAR, + -2.96589568540237556e-05 * DAYS_PER_YEAR], + 4.36624404335156298e-05 * SOLAR_MASS), + + 'neptune': ([1.53796971148509165e+01, + -2.59193146099879641e+01, + 1.79258772950371181e-01], + [2.68067772490389322e-03 * DAYS_PER_YEAR, + 1.62824170038242295e-03 * DAYS_PER_YEAR, + -9.51592254519715870e-05 * DAYS_PER_YEAR], + 5.15138902046611451e-05 * SOLAR_MASS)} + + +SYSTEM = list(BODIES.values()) +PAIRS = combinations(SYSTEM) + + +def advance(dt, n, bodies=SYSTEM, pairs=PAIRS): + for i in range(n): + for (([x1, y1, z1], v1, m1), + ([x2, y2, z2], v2, m2)) in pairs: + dx = x1 - x2 + dy = y1 - y2 + dz = z1 - z2 + mag = dt * ((dx * dx + dy * dy + dz * dz) ** (-1.5)) + b1m = m1 * mag + b2m = m2 * mag + v1[0] -= dx * b2m + v1[1] -= dy * b2m + v1[2] -= dz * b2m + v2[0] += dx * b1m + v2[1] += dy * b1m + v2[2] += dz * b1m + for (r, [vx, vy, vz], m) in bodies: + r[0] += dt * vx + r[1] += dt * vy + r[2] += dt * vz + + +def report_energy(bodies=SYSTEM, pairs=PAIRS, e=0.0): + for (((x1, y1, z1), v1, m1), + ((x2, y2, z2), v2, m2)) in pairs: + dx = x1 - x2 + dy = y1 - y2 + dz = z1 - z2 + e -= (m1 * m2) / ((dx * dx + dy * dy + dz * dz) ** 0.5) + for (r, [vx, vy, vz], m) in bodies: + e += m * (vx * vx + vy * vy + vz * vz) / 2. + return e + + +def offset_momentum(ref, bodies=SYSTEM, px=0.0, py=0.0, pz=0.0): + for (r, [vx, vy, vz], m) in bodies: + px -= vx * m + py -= vy * m + pz -= vz * m + (r, v, m) = ref + v[0] = px / m + v[1] = py / m + v[2] = pz / m + + +def bench_nbody(loops, reference, iterations): + # Set up global state + offset_momentum(BODIES[reference]) + + range_it = range(loops) + + for _ in range_it: + report_energy() + advance(0.01, iterations) + report_energy() + + +def add_cmdline_args(cmd, args): + cmd.extend(("--iterations", str(args.iterations))) + + +def run(): + parser = argparse.ArgumentParser(prog="python") + parser.add_argument("--iterations", + type=int, default=DEFAULT_ITERATIONS, + help="Number of nbody advance() iterations " + "(default: %s)" % DEFAULT_ITERATIONS) + parser.add_argument("--reference", + type=str, default=DEFAULT_REFERENCE, + help="nbody reference (default: %s)" + % DEFAULT_REFERENCE) + + args = parser.parse_args() + bench_nbody(1, args.reference, args.iterations) + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/nqueens.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/nqueens.py new file mode 100644 index 0000000000..61e3eb6547 --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/nqueens.py @@ -0,0 +1,72 @@ +"""Simple, brute-force N-Queens solver.""" + +__author__ = "collinwinter@google.com (Collin Winter)" + + +# Pure-Python implementation of itertools.permutations(). +def permutations(iterable, r=None): + """permutations(range(3), 2) --> (0,1) (0,2) (1,0) (1,2) (2,0) (2,1)""" + pool = tuple(iterable) + n = len(pool) + if r is None: + r = n + indices = list(range(n)) + cycles = list(range(n - r + 1, n + 1))[::-1] + yield tuple(pool[i] for i in indices[:r]) + while n: + for i in reversed(range(r)): + cycles[i] -= 1 + if cycles[i] == 0: + indices[i:] = indices[i + 1:] + indices[i:i + 1] + cycles[i] = n - i + else: + j = cycles[i] + indices[i], indices[-j] = indices[-j], indices[i] + yield tuple(pool[i] for i in indices[:r]) + break + else: + return + + +# From http://code.activestate.com/recipes/576647/ +def n_queens(queen_count): + """N-Queens solver. + + Args: + queen_count: the number of queens to solve for. This is also the + board size. + + Yields: + Solutions to the problem. Each yielded value is looks like + (3, 8, 2, 1, 4, ..., 6) where each number is the column position for the + queen, and the index into the tuple indicates the row. + """ + cols = range(queen_count) + for vec in permutations(cols): + if (queen_count == len(set(vec[i] + i for i in cols)) + == len(set(vec[i] - i for i in cols))): + yield vec + + +def bench_n_queens(queen_count): + list(n_queens(queen_count)) + + +def run(): + bench_n_queens(8) + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/pickle_dict.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/pickle_dict.py new file mode 100644 index 0000000000..b74c4ebfaf --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/pickle_dict.py @@ -0,0 +1,28 @@ +import sys +import os +# Add benchmark directory to path to allow import of bm_pickle.py +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) +import bm_pickle + +def run(): + bm_pickle.__benchmark__(["pickle_dict"]) + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } + + +def dependencies(): + return ["bm_pickle.py"] diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/pickle_list.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/pickle_list.py new file mode 100644 index 0000000000..f4bd72b3fc --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/pickle_list.py @@ -0,0 +1,28 @@ +import sys +import os +# Add benchmark directory to path to allow import of bm_pickle.py +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) +import bm_pickle + +def run(): + bm_pickle.__benchmark__(["pickle_list"]) + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } + + +def dependencies(): + return ["bm_pickle.py"] diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/pidigits.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/pidigits.py new file mode 100644 index 0000000000..ecf859d56a --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/pidigits.py @@ -0,0 +1,81 @@ +# coding: utf-8 +""" +Calculating some of the digits of π. + +This benchmark stresses big integer arithmetic. + +Adapted from code on: +http://benchmarksgame.alioth.debian.org/ +""" + +import itertools +import argparse + + +DEFAULT_DIGITS = 2000 +icount = itertools.count +islice = itertools.islice + + +def gen_x(): + return map(lambda k: (k, 4 * k + 2, 0, 2 * k + 1), icount(1)) + + +def compose(a, b): + aq, ar, as_, at = a + bq, br, bs, bt = b + return (aq * bq, + aq * br + ar * bt, + as_ * bq + at * bs, + as_ * br + at * bt) + + +def extract(z, j): + q, r, s, t = z + return (q * j + r) // (s * j + t) + + +def gen_pi_digits(): + z = (1, 0, 0, 1) + x = gen_x() + while 1: + y = extract(z, 3) + while y != extract(z, 4): + z = compose(z, next(x)) + y = extract(z, 3) + z = compose((10, -10 * y, 0, 1), z) + yield y + + +def calc_ndigits(n): + return list(islice(gen_pi_digits(), n)) + + +def add_cmdline_args(cmd, args): + cmd.extend(("--digits", str(args.digits))) + + +def run(): + cmd = argparse.ArgumentParser(prog="python") + cmd.add_argument("--digits", type=int, default=DEFAULT_DIGITS, + help="Number of computed pi digits (default: %s)" + % DEFAULT_DIGITS) + + args = cmd.parse_args() + calc_ndigits(args.digits) + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/pyflate.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/pyflate.py new file mode 100755 index 0000000000..2372fae59f --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/pyflate.py @@ -0,0 +1,676 @@ +#!/usr/bin/env python +""" +Copyright 2006--2007-01-21 Paul Sladen +http://www.paul.sladen.org/projects/compression/ + +You may use and distribute this code under any DFSG-compatible +license (eg. BSD, GNU GPLv2). + +Stand-alone pure-Python DEFLATE (gzip) and bzip2 decoder/decompressor. +This is probably most useful for research purposes/index building; there +is certainly some room for improvement in the Huffman bit-matcher. + +With the as-written implementation, there was a known bug in BWT +decoding to do with repeated strings. This has been worked around; +see 'bwt_reverse()'. Correct output is produced in all test cases +but ideally the problem would be found... +""" + +import hashlib +import os +import struct + + +int2byte = struct.Struct(">B").pack + + +class BitfieldBase(object): + + def __init__(self, x): + if isinstance(x, BitfieldBase): + self.f = x.f + self.bits = x.bits + self.bitfield = x.bitfield + self.count = x.bitfield + else: + self.f = x + self.bits = 0 + self.bitfield = 0x0 + self.count = 0 + + def _read(self, n): + s = self.f.read(n) + if not s: + raise "Length Error" + self.count += len(s) + return s + + def needbits(self, n): + while self.bits < n: + self._more() + + def _mask(self, n): + return (1 << n) - 1 + + def toskip(self): + return self.bits & 0x7 + + def align(self): + self.readbits(self.toskip()) + + def dropbits(self, n=8): + while n >= self.bits and n > 7: + n -= self.bits + self.bits = 0 + n -= len(self.f._read(n >> 3)) << 3 + if n: + self.readbits(n) + # No return value + + def dropbytes(self, n=1): + self.dropbits(n << 3) + + def tell(self): + return self.count - ((self.bits + 7) >> 3), 7 - ((self.bits - 1) & 0x7) + + def tellbits(self): + bytes, bits = self.tell() + return (bytes << 3) + bits + + +class Bitfield(BitfieldBase): + + def _more(self): + c = self._read(1) + self.bitfield += ord(c) << self.bits + self.bits += 8 + + def snoopbits(self, n=8): + if n > self.bits: + self.needbits(n) + return self.bitfield & self._mask(n) + + def readbits(self, n=8): + if n > self.bits: + self.needbits(n) + r = self.bitfield & self._mask(n) + self.bits -= n + self.bitfield >>= n + return r + + +class RBitfield(BitfieldBase): + + def _more(self): + c = self._read(1) + self.bitfield <<= 8 + self.bitfield += ord(c) + self.bits += 8 + + def snoopbits(self, n=8): + if n > self.bits: + self.needbits(n) + return (self.bitfield >> (self.bits - n)) & self._mask(n) + + def readbits(self, n=8): + if n > self.bits: + self.needbits(n) + r = (self.bitfield >> (self.bits - n)) & self._mask(n) + self.bits -= n + self.bitfield &= ~(self._mask(n) << self.bits) + return r + + +def printbits(v, n): + o = '' + for i in range(n): + if v & 1: + o = '1' + o + else: + o = '0' + o + v >>= 1 + return o + + +class HuffmanLength(object): + + def __init__(self, code, bits=0): + self.code = code + self.bits = bits + self.symbol = None + self.reverse_symbol = None + + def __repr__(self): + return repr((self.code, self.bits, self.symbol, self.reverse_symbol)) + + @staticmethod + def _sort_func(obj): + return (obj.bits, obj.code) + + +def reverse_bits(v, n): + a = 1 << 0 + b = 1 << (n - 1) + z = 0 + for i in range(n - 1, -1, -2): + z |= (v >> i) & a + z |= (v << i) & b + a <<= 1 + b >>= 1 + return z + + +def reverse_bytes(v, n): + a = 0xff << 0 + b = 0xff << (n - 8) + z = 0 + for i in range(n - 8, -8, -16): + z |= (v >> i) & a + z |= (v << i) & b + a <<= 8 + b >>= 8 + return z + + +class HuffmanTable(object): + + def __init__(self, bootstrap): + l = [] + start, bits = bootstrap[0] + for finish, endbits in bootstrap[1:]: + if bits: + for code in range(start, finish): + l.append(HuffmanLength(code, bits)) + start, bits = finish, endbits + if endbits == -1: + break + l.sort(key=HuffmanLength._sort_func) + self.table = l + + def populate_huffman_symbols(self): + bits, symbol = -1, -1 + for x in self.table: + symbol += 1 + if x.bits != bits: + symbol <<= (x.bits - bits) + bits = x.bits + x.symbol = symbol + x.reverse_symbol = reverse_bits(symbol, bits) + + def tables_by_bits(self): + d = {} + for x in self.table: + try: + d[x.bits].append(x) + except: # noqa + d[x.bits] = [x] + + def min_max_bits(self): + self.min_bits, self.max_bits = 16, -1 + for x in self.table: + if x.bits < self.min_bits: + self.min_bits = x.bits + if x.bits > self.max_bits: + self.max_bits = x.bits + + def _find_symbol(self, bits, symbol, table): + for h in table: + if h.bits == bits and h.reverse_symbol == symbol: + return h.code + return -1 + + def find_next_symbol(self, field, reversed=True): + cached_length = -1 + cached = None + for x in self.table: + if cached_length != x.bits: + cached = field.snoopbits(x.bits) + cached_length = x.bits + if (reversed and x.reverse_symbol == cached) or (not reversed and x.symbol == cached): + field.readbits(x.bits) + return x.code + raise Exception("unfound symbol, even after end of table @%r" + % field.tell()) + + for bits in range(self.min_bits, self.max_bits + 1): + r = self._find_symbol(bits, field.snoopbits(bits), self.table) + if 0 <= r: + field.readbits(bits) + return r + elif bits == self.max_bits: + raise "unfound symbol, even after max_bits" + + +class OrderedHuffmanTable(HuffmanTable): + + def __init__(self, lengths): + l = len(lengths) + z = list(zip(range(l), lengths)) + [(l, -1)] + HuffmanTable.__init__(self, z) + + +def code_length_orders(i): + return (16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, + 13, 2, 14, 1, 15)[i] + + +def distance_base(i): + return (1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, + 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, + 12289, 16385, 24577)[i] + + +def length_base(i): + return (3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, + 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258)[i - 257] + + +def extra_distance_bits(n): + if 0 <= n <= 1: + return 0 + elif 2 <= n <= 29: + return (n >> 1) - 1 + else: + raise "illegal distance code" + + +def extra_length_bits(n): + if 257 <= n <= 260 or n == 285: + return 0 + elif 261 <= n <= 284: + return ((n - 257) >> 2) - 1 + else: + raise "illegal length code" + + +def move_to_front(l, c): + l[:] = l[c:c + 1] + l[0:c] + l[c + 1:] + + +def bwt_transform(L): + # Semi-inefficient way to get the character counts + F = bytes(sorted(L)) + base = [] + for i in range(256): + base.append(F.find(int2byte(i))) + + pointers = [-1] * len(L) + for i, symbol in enumerate(L): + pointers[base[symbol]] = i + base[symbol] += 1 + return pointers + + +def bwt_reverse(L, end): + out = [] + if len(L): + T = bwt_transform(L) + + # STRAGENESS WARNING: There was a bug somewhere here in that + # if the output of the BWT resolves to a perfect copy of N + # identical strings (think exact multiples of 255 'X' here), + # then a loop is formed. When decoded, the output string would + # be cut off after the first loop, typically '\0\0\0\0\xfb'. + # The previous loop construct was: + # + # next = T[end] + # while next != end: + # out += L[next] + # next = T[next] + # out += L[next] + # + # For the moment, I've instead replaced it with a check to see + # if there has been enough output generated. I didn't figured + # out where the off-by-one-ism is yet---that actually produced + # the cyclic loop. + + for i in range(len(L)): + end = T[end] + out.append(L[end]) + + return bytes(out) + + +def compute_used(b): + huffman_used_map = b.readbits(16) + map_mask = 1 << 15 + used = [] + while map_mask > 0: + if huffman_used_map & map_mask: + huffman_used_bitmap = b.readbits(16) + bit_mask = 1 << 15 + while bit_mask > 0: + if huffman_used_bitmap & bit_mask: + pass + used += [bool(huffman_used_bitmap & bit_mask)] + bit_mask >>= 1 + else: + used += [False] * 16 + map_mask >>= 1 + return used + + +def compute_selectors_list(b, huffman_groups): + selectors_used = b.readbits(15) + mtf = list(range(huffman_groups)) + selectors_list = [] + for i in range(selectors_used): + # zero-terminated bit runs (0..62) of MTF'ed huffman table + c = 0 + while b.readbits(1): + c += 1 + if c >= huffman_groups: + raise "Bzip2 chosen selector greater than number of groups (max 6)" + if c >= 0: + move_to_front(mtf, c) + selectors_list.append(mtf[0]) + return selectors_list + + +def compute_tables(b, huffman_groups, symbols_in_use): + groups_lengths = [] + for j in range(huffman_groups): + length = b.readbits(5) + lengths = [] + for i in range(symbols_in_use): + if not 0 <= length <= 20: + raise "Bzip2 Huffman length code outside range 0..20" + while b.readbits(1): + length -= (b.readbits(1) * 2) - 1 + lengths += [length] + groups_lengths += [lengths] + + tables = [] + for g in groups_lengths: + codes = OrderedHuffmanTable(g) + codes.populate_huffman_symbols() + codes.min_max_bits() + tables.append(codes) + return tables + + +def decode_huffman_block(b, out): + randomised = b.readbits(1) + if randomised: + raise "Bzip2 randomised support not implemented" + pointer = b.readbits(24) + used = compute_used(b) + + huffman_groups = b.readbits(3) + if not 2 <= huffman_groups <= 6: + raise Exception("Bzip2: Number of Huffman groups not in range 2..6") + + selectors_list = compute_selectors_list(b, huffman_groups) + symbols_in_use = sum(used) + 2 # remember RUN[AB] RLE symbols + tables = compute_tables(b, huffman_groups, symbols_in_use) + + favourites = [int2byte(i) for i, x in enumerate(used) if x] + + selector_pointer = 0 + decoded = 0 + # Main Huffman loop + repeat = repeat_power = 0 + buffer = [] + t = None + while True: + decoded -= 1 + if decoded <= 0: + decoded = 50 # Huffman table re-evaluate/switch length + if selector_pointer <= len(selectors_list): + t = tables[selectors_list[selector_pointer]] + selector_pointer += 1 + + r = t.find_next_symbol(b, False) + if 0 <= r <= 1: + if repeat == 0: + repeat_power = 1 + repeat += repeat_power << r + repeat_power <<= 1 + continue + elif repeat > 0: + # Remember kids: If there is only one repeated + # real symbol, it is encoded with *zero* Huffman + # bits and not output... so buffer[-1] doesn't work. + buffer.append(favourites[0] * repeat) + repeat = 0 + if r == symbols_in_use - 1: + break + else: + o = favourites[r - 1] + move_to_front(favourites, r - 1) + buffer.append(o) + pass + + nt = nearly_there = bwt_reverse(b"".join(buffer), pointer) + i = 0 + # Pointless/irritating run-length encoding step + while i < len(nearly_there): + if i < len(nearly_there) - 4 and nt[i] == nt[i + 1] == nt[i + 2] == nt[i + 3]: + out.append(nearly_there[i:i + 1] * (ord(nearly_there[i + 4:i + 5]) + 4)) + i += 5 + else: + out.append(nearly_there[i:i + 1]) + i += 1 + +# Sixteen bits of magic have been removed by the time we start decoding + + +def bzip2_main(input): + b = RBitfield(input) + + method = b.readbits(8) + if method != ord('h'): + raise Exception( + "Unknown (not type 'h'uffman Bzip2) compression method") + + blocksize = b.readbits(8) + if ord('1') <= blocksize <= ord('9'): + blocksize = blocksize - ord('0') + else: + raise Exception("Unknown (not size '0'-'9') Bzip2 blocksize") + + out = [] + while True: + blocktype = b.readbits(48) + b.readbits(32) # crc + if blocktype == 0x314159265359: # (pi) + decode_huffman_block(b, out) + elif blocktype == 0x177245385090: # sqrt(pi) + b.align() + break + else: + raise Exception("Illegal Bzip2 blocktype") + return b''.join(out) + + +# Sixteen bits of magic have been removed by the time we start decoding +def gzip_main(field): + b = Bitfield(field) + method = b.readbits(8) + if method != 8: + raise Exception("Unknown (not type eight DEFLATE) compression method") + + # Use flags, drop modification time, extra flags and OS creator type. + flags = b.readbits(8) + b.readbits(32) # mtime + b.readbits(8) # extra_flags + b.readbits(8) # os_type + + if flags & 0x04: # structured GZ_FEXTRA miscellaneous data + xlen = b.readbits(16) + b.dropbytes(xlen) + while flags & 0x08: # original GZ_FNAME filename + if not b.readbits(8): + break + while flags & 0x10: # human readable GZ_FCOMMENT + if not b.readbits(8): + break + if flags & 0x02: # header-only GZ_FHCRC checksum + b.readbits(16) + + out = [] + while True: + lastbit = b.readbits(1) + blocktype = b.readbits(2) + + if blocktype == 0: + b.align() + length = b.readbits(16) + if length & b.readbits(16): + raise Exception("stored block lengths do not match each other") + for i in range(length): + out.append(int2byte(b.readbits(8))) + + elif blocktype == 1 or blocktype == 2: # Huffman + main_literals, main_distances = None, None + + if blocktype == 1: # Static Huffman + static_huffman_bootstrap = [ + (0, 8), (144, 9), (256, 7), (280, 8), (288, -1)] + static_huffman_lengths_bootstrap = [(0, 5), (32, -1)] + main_literals = HuffmanTable(static_huffman_bootstrap) + main_distances = HuffmanTable(static_huffman_lengths_bootstrap) + + elif blocktype == 2: # Dynamic Huffman + literals = b.readbits(5) + 257 + distances = b.readbits(5) + 1 + code_lengths_length = b.readbits(4) + 4 + + l = [0] * 19 + for i in range(code_lengths_length): + l[code_length_orders(i)] = b.readbits(3) + + dynamic_codes = OrderedHuffmanTable(l) + dynamic_codes.populate_huffman_symbols() + dynamic_codes.min_max_bits() + + # Decode the code_lengths for both tables at once, + # then split the list later + + code_lengths = [] + n = 0 + while n < (literals + distances): + r = dynamic_codes.find_next_symbol(b) + if 0 <= r <= 15: # literal bitlength for this code + count = 1 + what = r + elif r == 16: # repeat last code + count = 3 + b.readbits(2) + # Is this supposed to default to '0' if in the zeroth + # position? + what = code_lengths[-1] + elif r == 17: # repeat zero + count = 3 + b.readbits(3) + what = 0 + elif r == 18: # repeat zero lots + count = 11 + b.readbits(7) + what = 0 + else: + raise Exception( + "next code length is outside of the range 0 <= r <= 18") + code_lengths += [what] * count + n += count + + main_literals = OrderedHuffmanTable(code_lengths[:literals]) + main_distances = OrderedHuffmanTable(code_lengths[literals:]) + + # Common path for both Static and Dynamic Huffman decode now + + main_literals.populate_huffman_symbols() + main_distances.populate_huffman_symbols() + + main_literals.min_max_bits() + main_distances.min_max_bits() + + literal_count = 0 + while True: + r = main_literals.find_next_symbol(b) + if 0 <= r <= 255: + literal_count += 1 + out.append(int2byte(r)) + elif r == 256: + if literal_count > 0: + literal_count = 0 + break + elif 257 <= r <= 285: # dictionary lookup + if literal_count > 0: + literal_count = 0 + length_extra = b.readbits(extra_length_bits(r)) + length = length_base(r) + length_extra + + r1 = main_distances.find_next_symbol(b) + if 0 <= r1 <= 29: + distance = distance_base( + r1) + b.readbits(extra_distance_bits(r1)) + while length > distance: + out += out[-distance:] + length -= distance + if length == distance: + out += out[-distance:] + else: + out += out[-distance:length - distance] + elif 30 <= r1 <= 31: + raise Exception("illegal unused distance symbol " + "in use @%r" % b.tell()) + elif 286 <= r <= 287: + raise Exception("illegal unused literal/length symbol " + "in use @%r" % b.tell()) + elif blocktype == 3: + raise Exception("illegal unused blocktype in use @%r" % b.tell()) + + if lastbit: + break + + b.align() + b.readbits(32) # crc + b.readbits(32) # final_length + return "".join(out) + + +def bench_pyflake(loops, filename): + input_fp = open(filename, 'rb') + range_it = range(loops) + + for _ in range_it: + input_fp.seek(0) + field = RBitfield(input_fp) + + magic = field.readbits(16) + if magic == 0x1f8b: # GZip + out = gzip_main(field) + elif magic == 0x425a: # BZip2 + out = bzip2_main(field) + else: + raise Exception("Unknown file magic %x, not a gzip/bzip2 file" + % hex(magic)) + + input_fp.close() + + if hashlib.md5(out).hexdigest() != "afa004a630fe072901b1d9628b960974": + raise Exception("MD5 checksum mismatch") + + +def run(): + filename = os.path.join(os.path.dirname(__file__), + "data", "interpreter.tar.bz2") + bench_pyflake(1, filename) + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } + + +def dependencies(): + return ["data/interpreter.tar.bz2"] diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/regex_compile.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/regex_compile.py new file mode 100644 index 0000000000..fe8f79c628 --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/regex_compile.py @@ -0,0 +1,83 @@ + +"""Benchmark how quickly Python's regex implementation can compile regexes. + +We bring in all the regexes used by the other regex benchmarks, capture them by +stubbing out the re module, then compile those regexes repeatedly. We muck with +the re module's caching to force it to recompile every regex we give it. +""" + +# Python imports +import re +import sys +import os + + +def capture_regexes(): + regexes = [] + + real_compile = re.compile + real_search = re.search + real_sub = re.sub + + def capture_compile(regex, flags=0): + regexes.append((regex, flags)) + return real_compile(regex, flags) + + def capture_search(regex, target, flags=0): + regexes.append((regex, flags)) + return real_search(regex, target, flags) + + def capture_sub(regex, *args): + regexes.append((regex, 0)) + return real_sub(regex, *args) + + re.compile = capture_compile + re.search = capture_search + re.sub = capture_sub + try: + sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) + import regex_effbot + regex_effbot.bench_regex_effbot(1) + + import regex_v8 + regex_v8.bench_regex_v8(1) + finally: + re.compile = real_compile + re.search = real_search + re.sub = real_sub + return regexes + + +def bench_regex_compile(loops, regexes): + range_it = range(loops) + + for _ in range_it: + for regex, flags in regexes: + re.purge() + # ignore result (compiled regex) + re.compile(regex, flags) + + +def run(): + regexes = capture_regexes() + bench_regex_compile(1, regexes) + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } + + +def dependencies(): + return ["regex_effbot.py", "regex_v8.py"] diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/regex_dna.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/regex_dna.py new file mode 100644 index 0000000000..b275c3081d --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/regex_dna.py @@ -0,0 +1,239 @@ +#!/usr/bin/env python +""" +The Computer Language Benchmarks Game +http://benchmarksgame.alioth.debian.org/ + +regex-dna Python 3 #5 program: +contributed by Dominique Wahli +2to3 +modified by Justin Peel + +fasta Python 3 #3 program: +modified by Ian Osgood +modified again by Heinrich Acker +modified by Justin Peel +Modified by Christopher Sean Forgeron +""" + +import bisect +import re +import argparse + + +DEFAULT_INIT_LEN = 100000 +DEFAULT_RNG_SEED = 42 + +ALU = ('GGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGG' + 'GAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGA' + 'CCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAAT' + 'ACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCA' + 'GCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGG' + 'AGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCC' + 'AGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAA') + +IUB = list(zip('acgtBDHKMNRSVWY', [0.27, 0.12, 0.12, 0.27] + [0.02] * 11)) + +HOMOSAPIENS = [ + ('a', 0.3029549426680), + ('c', 0.1979883004921), + ('g', 0.1975473066391), + ('t', 0.3015094502008), +] + + +def make_cumulative(table): + P = [] + C = [] + prob = 0. + for char, p in table: + prob += p + P += [prob] + C += [ord(char)] + return (P, C) + + +def repeat_fasta(src, n, nprint): + width = 60 + + is_trailing_line = False + count_modifier = 0.0 + + len_of_src = len(src) + ss = src + src + src[:n % len_of_src] + # CSF - It's faster to work with a bytearray than a string + s = bytearray(ss, encoding='utf8') + + if n % width: + # We don't end on a 60 char wide line + is_trailing_line = True + count_modifier = 1.0 + + # CSF - Here we are stuck with using an int instead of a float for the loop, + # but testing showed it still to be faster than a for loop + count = 0 + end = (n / float(width)) - count_modifier + while count < end: + i = count * 60 % len_of_src + nprint(s[i:i + 60] + b'\n') + count += 1 + if is_trailing_line: + nprint(s[-(n % width):] + b'\n') + + +def random_fasta(table, n, seed, nprint): + width = 60 + r = range(width) + bb = bisect.bisect + + # If we don't have a multiple of the width, then we will have a trailing + # line, which needs a slightly different approach + is_trailing_line = False + count_modifier = 0.0 + + line = bytearray(width + 1) # Width of 60 + 1 for the \n char + + probs, chars = make_cumulative(table) + + # pRNG Vars + im = 139968.0 + seed = float(seed) + + if n % width: + # We don't end on a 60 char wide line + is_trailing_line = True + count_modifier = 1.0 + + # CSF - Loops with a high iteration count run faster as a while/float loop. + count = 0.0 + end = (n / float(width)) - count_modifier + while count < end: + # CSF - Low iteration count loops may run faster as a for loop. + for i in r: + # CSF - Python is faster for all float math than it is for int, on my + # machine at least. + seed = (seed * 3877.0 + 29573.0) % 139968.0 + # CSF - While real values, not variables are faster for most things, on my + # machine, it's faster to have 'im' already in a var + line[i] = chars[bb(probs, seed / im)] + + line[60] = 10 # End of Line + nprint(line) + count += 1.0 + + if is_trailing_line: + for i in range(n % width): + seed = (seed * 3877.0 + 29573.0) % 139968.0 + line[i] = chars[bb(probs, seed / im)] + + nprint(line[:i + 1] + b"\n") + + return seed + + +def init_benchmarks(n, rng_seed): + result = bytearray() + nprint = result.extend + nprint(b'>ONE Homo sapiens alu\n') + repeat_fasta(ALU, n * 2, nprint=nprint) + + # We need to keep track of the state of 'seed' so we pass it in, and return + # it back so our output can pass the diff test + nprint(b'>TWO IUB ambiguity codes\n') + seed = random_fasta(IUB, n * 3, seed=rng_seed, nprint=nprint) + + nprint(b'>THREE Homo sapiens frequency\n') + random_fasta(HOMOSAPIENS, n * 5, seed, nprint=nprint) + + return bytes(result) + + +VARIANTS = ( + b'agggtaaa|tttaccct', + b'[cgt]gggtaaa|tttaccc[acg]', + b'a[act]ggtaaa|tttacc[agt]t', + b'ag[act]gtaaa|tttac[agt]ct', + b'agg[act]taaa|ttta[agt]cct', + b'aggg[acg]aaa|ttt[cgt]ccct', + b'agggt[cgt]aa|tt[acg]accct', + b'agggta[cgt]a|t[acg]taccct', + b'agggtaa[cgt]|[acg]ttaccct', +) + +SUBST = ( + (b'B', b'(c|g|t)'), (b'D', b'(a|g|t)'), (b'H', b'(a|c|t)'), + (b'K', b'(g|t)'), (b'M', b'(a|c)'), (b'N', b'(a|c|g|t)'), + (b'R', b'(a|g)'), (b'S', b'(c|g)'), (b'V', b'(a|c|g)'), + (b'W', b'(a|t)'), (b'Y', b'(c|t)'), +) + + +def run_benchmarks(seq): + ilen = len(seq) + + seq = re.sub(b'>.*\n|\n', b'', seq) + clen = len(seq) + + results = [] + for f in VARIANTS: + results.append(len(re.findall(f, seq))) + + for f, r in SUBST: + seq = re.sub(f, r, seq) + + return results, ilen, clen, len(seq) + + +def bench_regex_dna(loops, seq, expected_res): + range_it = range(loops) + + for i in range_it: + res = run_benchmarks(seq) + + if (expected_res is not None) and (res != expected_res): + raise Exception("run_benchmarks() error") + + +def add_cmdline_args(cmd, args): + cmd.extend(("--fasta-length", str(args.fasta_length), + "--rng-seed", str(args.rng_seed))) + + +def run(): + cmd = argparse.ArgumentParser(prog="python") + cmd.add_argument("--fasta-length", type=int, default=DEFAULT_INIT_LEN, + help="Length of the fasta sequence " + "(default: %s)" % DEFAULT_INIT_LEN) + cmd.add_argument("--rng-seed", type=int, default=DEFAULT_RNG_SEED, + help="Seed of the random number generator " + "(default: %s)" % DEFAULT_RNG_SEED) + + args = cmd.parse_args() + if args.fasta_length == 100000: + expected_len = 1016745 + expected_res = ([6, 26, 86, 58, 113, 31, 31, 32, 43], + 1016745, 1000000, 1336326) + else: + expected_len = None + expected_res = None + + seq = init_benchmarks(args.fasta_length, args.rng_seed) + if (expected_len is not None) and (len(seq) != expected_len): + raise Exception("init_benchmarks() error") + + bench_regex_dna(1, seq, expected_res) + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/regex_effbot.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/regex_effbot.py new file mode 100644 index 0000000000..4fb1b26915 --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/regex_effbot.py @@ -0,0 +1,183 @@ + +"""Benchmarks for Python's regex engine. + +These are some of the original benchmarks used to tune Python's regex engine +in 2000 written by Fredrik Lundh. Retreived from +http://mail.python.org/pipermail/python-dev/2000-August/007797.html and +integrated into Unladen Swallow's pyperf.py in 2009 by David Laing. + +These benchmarks are of interest since they helped to guide the original +optimization of the sre engine, and we shouldn't necessarily ignore them just +because they're "old". +""" + +# Python imports +import re +import argparse + +USE_BYTES = False + + +def re_compile(s): + if USE_BYTES: + return re.compile(s.encode('latin1')) + else: + return re.compile(s) + +# These are the regular expressions to be tested. These sync up, +# index-for-index with the list of strings generated by gen_string_table() +# below. + + +def gen_regex_table(): + return [ + re_compile('Python|Perl'), + re_compile('Python|Perl'), + re_compile('(Python|Perl)'), + re_compile('(?:Python|Perl)'), + re_compile('Python'), + re_compile('Python'), + re_compile('.*Python'), + re_compile('.*Python.*'), + re_compile('.*(Python)'), + re_compile('.*(?:Python)'), + re_compile('Python|Perl|Tcl'), + re_compile('Python|Perl|Tcl'), + re_compile('(Python|Perl|Tcl)'), + re_compile('(?:Python|Perl|Tcl)'), + re_compile('(Python)\\1'), + re_compile('(Python)\\1'), + re_compile('([0a-z][a-z0-9]*,)+'), + re_compile('(?:[0a-z][a-z0-9]*,)+'), + re_compile('([a-z][a-z0-9]*,)+'), + re_compile('(?:[a-z][a-z0-9]*,)+'), + re_compile('.*P.*y.*t.*h.*o.*n.*')] + + +def gen_string_table(n): + """Generates the list of strings that will be used in the benchmarks. + + All strings have repeated prefixes and suffices, and n specifies the + number of repetitions. + """ + strings = [] + + def append(s): + if USE_BYTES: + strings.append(s.encode('latin1')) + else: + strings.append(s) + append('-' * n + 'Perl' + '-' * n) + append('P' * n + 'Perl' + 'P' * n) + append('-' * n + 'Perl' + '-' * n) + append('-' * n + 'Perl' + '-' * n) + append('-' * n + 'Python' + '-' * n) + append('P' * n + 'Python' + 'P' * n) + append('-' * n + 'Python' + '-' * n) + append('-' * n + 'Python' + '-' * n) + append('-' * n + 'Python' + '-' * n) + append('-' * n + 'Python' + '-' * n) + append('-' * n + 'Perl' + '-' * n) + append('P' * n + 'Perl' + 'P' * n) + append('-' * n + 'Perl' + '-' * n) + append('-' * n + 'Perl' + '-' * n) + append('-' * n + 'PythonPython' + '-' * n) + append('P' * n + 'PythonPython' + 'P' * n) + append('-' * n + 'a5,b7,c9,' + '-' * n) + append('-' * n + 'a5,b7,c9,' + '-' * n) + append('-' * n + 'a5,b7,c9,' + '-' * n) + append('-' * n + 'a5,b7,c9,' + '-' * n) + append('-' * n + 'Python' + '-' * n) + return strings + + +def init_benchmarks(n_values=None): + """Initialize the strings we'll run the regexes against. + + The strings used in the benchmark are prefixed and suffixed by + strings that are repeated n times. + + The sequence n_values contains the values for n. + If n_values is None the values of n from the original benchmark + are used. + + The generated list of strings is cached in the string_tables + variable, which is indexed by n. + + Returns: + A list of string prefix/suffix lengths. + """ + + if n_values is None: + n_values = (0, 5, 50, 250, 1000, 5000, 10000) + + string_tables = {n: gen_string_table(n) for n in n_values} + regexs = gen_regex_table() + + data = [] + for n in n_values: + for id in range(len(regexs)): + regex = regexs[id] + string = string_tables[n][id] + data.append((regex, string)) + return data + + +def bench_regex_effbot(loops): + if bench_regex_effbot.data is None: + bench_regex_effbot.data = init_benchmarks() + data = bench_regex_effbot.data + + range_it = range(loops) + search = re.search + + for _ in range_it: + # Runs all of the benchmarks for a given value of n. + for regex, string in data: + # search 10 times + search(regex, string) + search(regex, string) + search(regex, string) + search(regex, string) + search(regex, string) + search(regex, string) + search(regex, string) + search(regex, string) + search(regex, string) + search(regex, string) + + +# cached data, generated at the first call +bench_regex_effbot.data = None + + +def add_cmdline_args(cmd, args): + if args.force_bytes: + cmd.append("--force_bytes") + + +def run(): + parser = argparse.ArgumentParser(prog="python") + parser.add_argument("-B", "--force_bytes", action="store_true", + help="test bytes regexps") + options = parser.parse_args() + if options.force_bytes: + USE_BYTES = True + + bench_regex_effbot(4) + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/regex_v8.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/regex_v8.py new file mode 100644 index 0000000000..74ad1c868e --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/regex_v8.py @@ -0,0 +1,1798 @@ +# Copyright 2009 the V8 project authors. All rights reserved. +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +# Automatically generated on 2009-01-30. + +# This benchmark is generated by loading 50 of the most popular pages +# on the web and logging all regexp operations performed. Each +# operation is given a weight that is calculated from an estimate of +# the popularity of the pages where it occurs and the number of times +# it is executed while loading each page. Finally the literal +# letters in the data are encoded using ROT13 in a way that does not +# affect how the regexps match their input. + + +# Ported to Python for Unladen Swallow. The original JS version can be found at +# https://github.com/v8/v8/blob/master/benchmarks/regexp.js, r1243. + +# Python imports +import re + + +# The precompiled regexs that were in vars in the V8 code, split into +# tuples of (regex, flags). +compiled_regex_strings = [ + (r'^ba', ''), + (r'(((\w+):\/\/)([^\/:]*)(:(\d+))?)?([^#?]*)(\?([^#]*))?(#(.*))?', ''), + (r'^\s*|\s*$', 'g'), + (r'\bQBZPbageby_cynprubyqre\b', ''), + (r',', ''), + (r'\bQBZPbageby_cynprubyqre\b', 'g'), + (r'^[\s\xa0]+|[\s\xa0]+$', 'g'), + (r'(\d*)(\D*)', 'g'), + (r'=', ''), + (r'(^|\s)lhv\-h(\s|$)', ''), + (r'\#', 'g'), + (r'\.', 'g'), + (r'\'', 'g'), + (r'\?[\w\W]*(sevraqvq|punaaryvq|tebhcvq)=([^\&\?#]*)', 'i'), + (r'\s+', 'g'), + (r'^\s*(\S*(\s+\S+)*)\s*$', ''), + (r'(-[a-z])', 'i'), + (r'(^|[^\\])\"\\\/Qngr\((-?[0-9]+)\)\\\/\"', 'g'), + (r'^\s+|\s+$', 'g'), + (r'(?:^|\s+)ba(?:\s+|$)', ''), + (r'[+, ]', ''), + (r'ybnqrq|pbzcyrgr', ''), + (r'\bso_zrah\b', ''), + (r'^(?:(?:[^:\/?#]+):)?(?:\/\/(?:[^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?', ''), + (r'uggcf?:\/\/([^\/]+\.)?snprobbx\.pbz\/', ''), + (r'"', 'g'), + (r'^([^?#]+)(?:\?([^#]*))?(#.*)?', ''), + (r'-\D', 'g'), + (r'\bnpgvingr\b', ''), + (r'%2R', 'gi'), + (r'%2S', 'gi'), + (r'^(mu-(PA|GJ)|wn|xb)$', ''), + (r'\s?;\s?', ''), + (r'%\w?$', ''), + (r'TNQP=([^;]*)', 'i'), + (r'[<>]', 'g'), + (r'uers|fep|fryrpgrq', ''), + (r'\s*([+>~\s])\s*([a-zA-Z#.*:\[])', 'g'), + (r'^(\w+|\*)$', ''), + (r'\\\\', 'g'), + (r' ', 'g'), + (r'\/\xc4\/t', ''), + (r'\/\xd6\/t', ''), + (r'\/\xdc\/t', ''), + (r'\/\xdf\/t', ''), + (r'\/\xe4\/t', ''), + (r'\/\xf6\/t', ''), + (r'\/\xfc\/t', ''), + (r'\W', 'g'), + (r'uers|fep|fglyr', ''), + (r'(?:^|\s+)fryrpgrq(?:\s+|$)', ''), + (r'\&', 'g'), + (r'\+', 'g'), + (r'\?', 'g'), + (r'\t', 'g'), + (r'(\$\{nqiHey\})|(\$nqiHey\b)', 'g'), + (r'(\$\{cngu\})|(\$cngu\b)', 'g'), + (r'##yv4##', 'gi'), + (r'##yv16##', 'gi'), + (r'##yv19##', 'gi'), + (r'(?:^|\s+)bss(?:\s+|$)', ''), + (r'^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$', ''), + (r'^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$', ''), + (r'\{0\}', 'g'), + (r'\b[a-z]', 'g'), + (r'^uggc:\/\/', ''), + (r'(?:^|\s+)qvfnoyrq(?:\s+|$)', ''), + (r'zrah_byq', 'g'), + (r'^([#.]?)((?:[\w' + '\u0128-\uffff' + r'*_-]|\\.)*)', ''), + (r'\{1\}', 'g'), + (r'\s+', ''), + (r'(\$\{4\})|(\$4\b)', 'g'), + (r'(\$\{5\})|(\$5\b)', 'g'), + (r'\{2\}', 'g'), + (r'[^+>] [^+>]', ''), + (r'\bucpyv\s*=\s*([^;]*)', 'i'), + (r'\bucuvqr\s*=\s*([^;]*)', 'i'), + (r'\bucfie\s*=\s*([^;]*)', 'i'), + (r'\bhfucjrn\s*=\s*([^;]*)', 'i'), + (r'\bmvc\s*=\s*([^;]*)', 'i'), + (r'^((?:[\w' + '\u0128-\uffff' + r'*_-]|\\.)+)(#)((?:[\w' + + '\u0128-\uffff' + r'*_-]|\\.)+)', ''), + (r'^([>+~])\s*(\w*)', 'i'), + (r'^>\s*((?:[\w' + '\u0128-\uffff' + r'*_-]|\\.)+)', ''), + (r'^[\s[]?shapgvba', ''), + (r'v\/g.tvs#(.*)', 'i'), + (r'eaq_zbqobkva', ''), + (r';\s*', ''), + (r'(\$\{inyhr\})|(\$inyhr\b)', 'g'), + (r'(\$\{abj\})|(\$abj\b)', 'g'), + (r'\s+$', ''), + (r'^\s+', ''), + (r'(\\\"|\x00-|\x1f|\x7f-|\x9f|' + + '\u00ad|\u0600-|\u0604|\u070f|\u17b4|\u17b5|\u200c-|\u200f|\u2028-|\u202f|\u2060-|\u206f|\ufeff|\ufff0-|\uffff' + r')', 'g'), + (r'^(:)([\w-]+)\("?\'?(.*?(\(.*?\))?[^(]*?)"?\'?\)', ''), + (r'^([:.#]*)((?:[\w' + '\u0128-\uffff' + r'*_-]|\\.)+)', ''), + (r'^(\[) *@?([\w-]+) *([!*$^~=]*) *(\'?"?)(.*?)\4 *\]', '')] + + +# The V8 javascript engine only does one replacement unless the regexp has +# the 'g' flag. Python's sub has count = 1 to do 1 replacement and count = 0 +# to replace all matches. We set this up here. + +regexs = [] +subcount = [] + +for s in compiled_regex_strings: + if 'g' in s[1]: + subcount.append(0) + else: + subcount.append(1) + + if 'i' in s[1]: + regexs.append(re.compile(s[0], re.IGNORECASE | re.UNICODE)) + else: + regexs.append(re.compile(s[0], re.UNICODE)) + +# The strings that were in vars in the V8 benchmark + +strings = [ + r'Zbmvyyn/5.0 (Jvaqbjf; H; Jvaqbjf AG 5.1; ra-HF) NccyrJroXvg/528.9 (XUGZY, yvxr Trpxb) Puebzr/2.0.157.0 Fnsnev/528.9', + r'Fubpxjnir Synfu 9.0 e115', + r'{"anzr":"","ahzoreSbezng":{"PheeraplQrpvznyQvtvgf":2,"PheeraplQrpvznyFrcnengbe":".","VfErnqBayl":gehr,"PheeraplTebhcFvmrf":[3],"AhzoreTebhcFvmrf":[3],"CrepragTebhcFvmrf":[3],"PheeraplTebhcFrcnengbe":",","PheeraplFlzoby":"\xa4","AnAFlzoby":"AnA","PheeraplArtngvirCnggrea":0,"AhzoreArtngvirCnggrea":1,"CrepragCbfvgvirCnggrea":0,"CrepragArtngvirCnggrea":0,"ArtngvirVasvavglFlzoby":"-Vasvavgl","ArtngvirFvta":"-","AhzoreQrpvznyQvtvgf":2,"AhzoreQrpvznyFrcnengbe":".","AhzoreTebhcFrcnengbe":",","PheeraplCbfvgvirCnggrea":0,"CbfvgvirVasvavglFlzoby":"Vasvavgl","CbfvgvirFvta":"+","CrepragQrpvznyQvtvgf":2,"CrepragQrpvznyFrcnengbe":".","CrepragTebhcFrcnengbe":",","CrepragFlzoby":"%","CreZvyyrFlzoby":"\u2030","AngvirQvtvgf":["0","1","2","3","4","5","6","7","8","9"],"QvtvgFhofgvghgvba":1},"qngrGvzrSbezng":{"NZQrfvtangbe":"NZ","Pnyraqne":{"ZvaFhccbegrqQngrGvzr":"@-62135568000000@","ZnkFhccbegrqQngrGvzr":"@253402300799999@","NytbevguzGlcr":1,"PnyraqneGlcr":1,"Renf":[1],"GjbQvtvgLrneZnk":2029,"VfErnqBayl":gehr},"QngrFrcnengbe":"/","SvefgQnlBsJrrx":0,"PnyraqneJrrxEhyr":0,"ShyyQngrGvzrCnggrea":"qqqq, qq ZZZZ llll UU:zz:ff","YbatQngrCnggrea":"qqqq, qq ZZZZ llll","YbatGvzrCnggrea":"UU:zz:ff","ZbaguQnlCnggrea":"ZZZZ qq","CZQrfvtangbe":"CZ","ESP1123Cnggrea":"qqq, qq ZZZ llll UU\':\'zz\':\'ff \'TZG\'","FubegQngrCnggrea":"ZZ/qq/llll","FubegGvzrCnggrea":"UU:zz","FbegnoyrQngrGvzrCnggrea":"llll\'-\'ZZ\'-\'qq\'G\'UU\':\'zz\':\'ff","GvzrFrcnengbe":":","HavirefnyFbegnoyrQngrGvzrCnggrea":"llll\'-\'ZZ\'-\'qq UU\':\'zz\':\'ff\'M\'","LrneZbaguCnggrea":"llll ZZZZ","NooerivngrqQnlAnzrf":["Fha","Zba","Ghr","Jrq","Guh","Sev","Fng"],"FubegrfgQnlAnzrf":["Fh","Zb","Gh","Jr","Gu","Se","Fn"],"QnlAnzrf":["Fhaqnl","Zbaqnl","Ghrfqnl","Jrqarfqnl","Guhefqnl","Sevqnl","Fngheqnl"],"NooerivngrqZbaguAnzrf":["Wna","Sro","Zne","Nce","Znl","Wha","Why","Nht","Frc","Bpg","Abi","Qrp",""],"ZbaguAnzrf":["Wnahnel","Sroehnel","Znepu","Ncevy","Znl","Whar","Whyl","Nhthfg","Frcgrzore","Bpgbore","Abirzore","Qrprzore",""],"VfErnqBayl":gehr,"AngvirPnyraqneAnzr":"Tertbevna Pnyraqne","NooerivngrqZbaguTravgvirAnzrf":["Wna","Sro","Zne","Nce","Znl","Wha","Why","Nht","Frc","Bpg","Abi","Qrp",""],"ZbaguTravgvirAnzrf":["Wnahnel","Sroehnel","Znepu","Ncevy","Znl","Whar","Whyl","Nhthfg","Frcgrzore","Bpgbore","Abirzore","Qrprzore",""]}}', + r'{"anzr":"ra-HF","ahzoreSbezng":{"PheeraplQrpvznyQvtvgf":2,"PheeraplQrpvznyFrcnengbe":".","VfErnqBayl":snyfr,"PheeraplTebhcFvmrf":[3],"AhzoreTebhcFvmrf":[3],"CrepragTebhcFvmrf":[3],"PheeraplTebhcFrcnengbe":",","PheeraplFlzoby":"$","AnAFlzoby":"AnA","PheeraplArtngvirCnggrea":0,"AhzoreArtngvirCnggrea":1,"CrepragCbfvgvirCnggrea":0,"CrepragArtngvirCnggrea":0,"ArtngvirVasvavglFlzoby":"-Vasvavgl","ArtngvirFvta":"-","AhzoreQrpvznyQvtvgf":2,"AhzoreQrpvznyFrcnengbe":".","AhzoreTebhcFrcnengbe":",","PheeraplCbfvgvirCnggrea":0,"CbfvgvirVasvavglFlzoby":"Vasvavgl","CbfvgvirFvta":"+","CrepragQrpvznyQvtvgf":2,"CrepragQrpvznyFrcnengbe":".","CrepragTebhcFrcnengbe":",","CrepragFlzoby":"%","CreZvyyrFlzoby":"\u2030","AngvirQvtvgf":["0","1","2","3","4","5","6","7","8","9"],"QvtvgFhofgvghgvba":1},"qngrGvzrSbezng":{"NZQrfvtangbe":"NZ","Pnyraqne":{"ZvaFhccbegrqQngrGvzr":"@-62135568000000@","ZnkFhccbegrqQngrGvzr":"@253402300799999@","NytbevguzGlcr":1,"PnyraqneGlcr":1,"Renf":[1],"GjbQvtvgLrneZnk":2029,"VfErnqBayl":snyfr},"QngrFrcnengbe":"/","SvefgQnlBsJrrx":0,"PnyraqneJrrxEhyr":0,"ShyyQngrGvzrCnggrea":"qqqq, ZZZZ qq, llll u:zz:ff gg","YbatQngrCnggrea":"qqqq, ZZZZ qq, llll","YbatGvzrCnggrea":"u:zz:ff gg","ZbaguQnlCnggrea":"ZZZZ qq","CZQrfvtangbe":"CZ","ESP1123Cnggrea":"qqq, qq ZZZ llll UU\':\'zz\':\'ff \'TZG\'","FubegQngrCnggrea":"Z/q/llll","FubegGvzrCnggrea":"u:zz gg","FbegnoyrQngrGvzrCnggrea":"llll\'-\'ZZ\'-\'qq\'G\'UU\':\'zz\':\'ff","GvzrFrcnengbe":":","HavirefnyFbegnoyrQngrGvzrCnggrea":"llll\'-\'ZZ\'-\'qq UU\':\'zz\':\'ff\'M\'","LrneZbaguCnggrea":"ZZZZ, llll","NooerivngrqQnlAnzrf":["Fha","Zba","Ghr","Jrq","Guh","Sev","Fng"],"FubegrfgQnlAnzrf":["Fh","Zb","Gh","Jr","Gu","Se","Fn"],"QnlAnzrf":["Fhaqnl","Zbaqnl","Ghrfqnl","Jrqarfqnl","Guhefqnl","Sevqnl","Fngheqnl"],"NooerivngrqZbaguAnzrf":["Wna","Sro","Zne","Nce","Znl","Wha","Why","Nht","Frc","Bpg","Abi","Qrp",""],"ZbaguAnzrf":["Wnahnel","Sroehnel","Znepu","Ncevy","Znl","Whar","Whyl","Nhthfg","Frcgrzore","Bpgbore","Abirzore","Qrprzore",""],"VfErnqBayl":snyfr,"AngvirPnyraqneAnzr":"Tertbevna Pnyraqne","NooerivngrqZbaguTravgvirAnzrf":["Wna","Sro","Zne","Nce","Znl","Wha","Why","Nht","Frc","Bpg","Abi","Qrp",""],"ZbaguTravgvirAnzrf":["Wnahnel","Sroehnel","Znepu","Ncevy","Znl","Whar","Whyl","Nhthfg","Frcgrzore","Bpgbore","Abirzore","Qrprzore",""]}}', + r'HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q', + r'HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R=', + r'uggc://jjj.snprobbx.pbz/vaqrk.cuc', + r';;jvaqbj.IjPurpxZbhfrCbfvgvbaNQ_VQ=shapgvba(r){vs(!r)ine r=jvaqbj.rirag;ine c=-1;vs(d1)c=d1.EbyybssCnary;ine bo=IjTrgBow("IjCnayNQ_VQ_"+c);vs(bo&&bo.fglyr.ivfvovyvgl=="ivfvoyr"){ine fns=IjFns?8:0;ine pheK=r.pyvragK+IjBOFpe("U")+fns,pheL=r.pyvragL+IjBOFpe("I")+fns;ine y=IjBOEC(NQ_VQ,bo,"Y"),g=IjBOEC(NQ_VQ,bo,"G");ine e=y+d1.Cnaryf[c].Jvqgu,o=g+d1.Cnaryf[c].Urvtug;vs((pheKe)||(pheLo)){vs(jvaqbj.IjBaEbyybssNQ_VQ)IjBaEbyybssNQ_VQ(c);ryfr IjPybfrNq(NQ_VQ,c,gehr,"");}ryfr erghea;}IjPnapryZbhfrYvfgrareNQ_VQ();};;jvaqbj.IjFrgEbyybssCnaryNQ_VQ=shapgvba(c){ine z="zbhfrzbir",q=qbphzrag,s=IjPurpxZbhfrCbfvgvbaNQ_VQ;c=IjTc(NQ_VQ,c);vs(d1&&d1.EbyybssCnary>-1)IjPnapryZbhfrYvfgrareNQ_VQ();vs(d1)d1.EbyybssCnary=c;gel{vs(q.nqqRiragYvfgrare)q.nqqRiragYvfgrare(z,s,snyfr);ryfr vs(q.nggnpuRirag)q.nggnpuRirag("ba"+z,s);}pngpu(r){}};;jvaqbj.IjPnapryZbhfrYvfgrareNQ_VQ=shapgvba(){ine z="zbhfrzbir",q=qbphzrag,s=IjPurpxZbhfrCbfvgvbaNQ_VQ;vs(d1)d1.EbyybssCnary=-1;gel{vs(q.erzbirRiragYvfgrare)q.erzbirRiragYvfgrare(z,s,snyfr);ryfr vs(q.qrgnpuRirag)q.qrgnpuRirag("ba"+z,s);}pngpu(r){}};;d1.IjTc=d2(n,c){ine nq=d1;vs(vfAnA(c)){sbe(ine v=0;v0){vs(nq.FzV.yratgu>0)nq.FzV+="/";nq.FzV+=vh[v];nq.FtZ[nq.FtZ.yratgu]=snyfr;}}};;d1.IjYvzvg0=d2(n,f){ine nq=d1,vh=f.fcyvg("/");sbe(ine v=0;v0){vs(nq.OvC.yratgu>0)nq.OvC+="/";nq.OvC+=vh[v];}}};;d1.IjRVST=d2(n,c){jvaqbj["IjCnayNQ_VQ_"+c+"_Bow"]=IjTrgBow("IjCnayNQ_VQ_"+c+"_Bow");vs(jvaqbj["IjCnayNQ_VQ_"+c+"_Bow"]==ahyy)frgGvzrbhg("IjRVST(NQ_VQ,"+c+")",d1.rvsg);};;d1.IjNavzSHC=d2(n,c){ine nq=d1;vs(c>nq.Cnaryf.yratgu)erghea;ine cna=nq.Cnaryf[c],nn=gehr,on=gehr,yn=gehr,en=gehr,cn=nq.Cnaryf[0],sf=nq.ShF,j=cn.Jvqgu,u=cn.Urvtug;vs(j=="100%"){j=sf;en=snyfr;yn=snyfr;}vs(u=="100%"){u=sf;nn=snyfr;on=snyfr;}vs(cn.YnY=="Y")yn=snyfr;vs(cn.YnY=="E")en=snyfr;vs(cn.GnY=="G")nn=snyfr;vs(cn.GnY=="O")on=snyfr;ine k=0,l=0;fjvgpu(nq.NshP%8){pnfr 0:oernx;pnfr 1:vs(nn)l=-sf;oernx;pnfr 2:k=j-sf;oernx;pnfr 3:vs(en)k=j;oernx;pnfr 4:k=j-sf;l=u-sf;oernx;pnfr 5:k=j-sf;vs(on)l=u;oernx;pnfr 6:l=u-sf;oernx;pnfr 7:vs(yn)k=-sf;l=u-sf;oernx;}vs(nq.NshP++ 0)||(nethzragf.yratgu==3&&bG>0))){pyrneGvzrbhg(cay.UgU);cay.UgU=frgGvzrbhg(cay.UvqrNpgvba,(nethzragf.yratgu==3?bG:cay.UvqrGvzrbhgInyhr));}};;d1.IjErfrgGvzrbhg=d2(n,c,bG){c=IjTc(n,c);IjPnapryGvzrbhg(n,c);riny("IjFgnegGvzrbhg(NQ_VQ,c"+(nethzragf.yratgu==3?",bG":"")+")");};;d1.IjErfrgNyyGvzrbhgf=d2(n){sbe(ine c=0;ce)||(pheLo)){vs(jvaqbj.IjBaEbyybssNQ_VQ)IjBaEbyybssNQ_VQ(c);ryfr IjPybfrNq(NQ_VQ,c,gehr,"");}ryfr erghea;}IjPnapryZbhfrYvfgrareNQ_VQ();};;jvaqbj.IjFrgEbyybssCnaryNQ_VQ=shapgvba(c){ine z="zbhfrzbir",q=qbphzrag,s=IjPurpxZbhfrCbfvgvbaNQ_VQ;c=IjTc(NQ_VQ,c);vs(jvaqbj.IjNqNQ_VQ&&jvaqbj.IjNqNQ_VQ.EbyybssCnary>-1)IjPnapryZbhfrYvfgrareNQ_VQ();vs(jvaqbj.IjNqNQ_VQ)jvaqbj.IjNqNQ_VQ.EbyybssCnary=c;gel{vs(q.nqqRiragYvfgrare)q.nqqRiragYvfgrare(z,s,snyfr);ryfr vs(q.nggnpuRirag)q.nggnpuRirag("ba"+z,s);}pngpu(r){}};;jvaqbj.IjPnapryZbhfrYvfgrareNQ_VQ=shapgvba(){ine z="zbhfrzbir",q=qbphzrag,s=IjPurpxZbhfrCbfvgvbaNQ_VQ;vs(jvaqbj.IjNqNQ_VQ)jvaqbj.IjNqNQ_VQ.EbyybssCnary=-1;gel{vs(q.erzbirRiragYvfgrare)q.erzbirRiragYvfgrare(z,s,snyfr);ryfr vs(q.qrgnpuRirag)q.qrgnpuRirag("ba"+z,s);}pngpu(r){}};;jvaqbj.IjNqNQ_VQ.IjTc=shapgvba(n,c){ine nq=jvaqbj.IjNqNQ_VQ;vs(vfAnA(c)){sbe(ine v=0;v0){vs(nq.FzV.yratgu>0)nq.FzV+="/";nq.FzV+=vh[v];nq.FtZ[nq.FtZ.yratgu]=snyfr;}}};;jvaqbj.IjNqNQ_VQ.IjYvzvg0=shapgvba(n,f){ine nq=jvaqbj.IjNqNQ_VQ,vh=f.fcyvg("/");sbe(ine v=0;v0){vs(nq.OvC.yratgu>0)nq.OvC+="/";nq.OvC+=vh[v];}}};;jvaqbj.IjNqNQ_VQ.IjRVST=shapgvba(n,c){jvaqbj["IjCnayNQ_VQ_"+c+"_Bow"]=IjTrgBow("IjCnayNQ_VQ_"+c+"_Bow");vs(jvaqbj["IjCnayNQ_VQ_"+c+"_Bow"]==ahyy)frgGvzrbhg("IjRVST(NQ_VQ,"+c+")",jvaqbj.IjNqNQ_VQ.rvsg);};;jvaqbj.IjNqNQ_VQ.IjNavzSHC=shapgvba(n,c){ine nq=jvaqbj.IjNqNQ_VQ;vs(c>nq.Cnaryf.yratgu)erghea;ine cna=nq.Cnaryf[c],nn=gehr,on=gehr,yn=gehr,en=gehr,cn=nq.Cnaryf[0],sf=nq.ShF,j=cn.Jvqgu,u=cn.Urvtug;vs(j=="100%"){j=sf;en=snyfr;yn=snyfr;}vs(u=="100%"){u=sf;nn=snyfr;on=snyfr;}vs(cn.YnY=="Y")yn=snyfr;vs(cn.YnY=="E")en=snyfr;vs(cn.GnY=="G")nn=snyfr;vs(cn.GnY=="O")on=snyfr;ine k=0,l=0;fjvgpu(nq.NshP%8){pnfr 0:oernx;pnfr 1:vs(nn)l=-sf;oernx;pnfr 2:k=j-sf;oernx;pnfr 3:vs(en)k=j;oernx;pnfr 4:k=j-sf;l=u-sf;oernx;pnfr 5:k=j-sf;vs(on)l=u;oernx;pnfr 6:l=u-sf;oernx;pnfr 7:vs(yn)k=-sf;l=u-sf;oernx;}vs(nq.NshP++ 0)||(nethzragf.yratgu==3&&bG>0))){pyrneGvzrbhg(cay.UgU);cay.UgU=frgGvzrbhg(cay.UvqrNpgvba,(nethzragf.yratgu==3?bG:cay.UvqrGvzrbhgInyhr));}};;jvaqbj.IjNqNQ_VQ.IjErfrgGvzrbhg=shapgvba(n,c,bG){c=IjTc(n,c);IjPnapryGvzrbhg(n,c);riny("IjFgnegGvzrbhg(NQ_VQ,c"+(nethzragf.yratgu==3?",bG":"")+")");};;jvaqbj.IjNqNQ_VQ.IjErfrgNyyGvzrbhgf=shapgvba(n){sbe(ine c=0;ce)||(pheLo)){vs(jvaqbj.IjBaEbyybssNQ_VQ)IjBaEbyybssNQ_VQ(c);ryfr IjPybfrNq(NQ_VQ,c,gehr,"");}ryfr erghea;}IjPnapryZbhfrYvfgrareNQ_VQ();};;jvaqbj.IjFrgEbyybssCnaryNQ_VQ=shapgvba(c){ine z="zbhfrzbir",q=qbphzrag,s=IjPurpxZbhfrCbfvgvbaNQ_VQ;c=IjTc(NQ_VQ,c);vs(jvaqbj.IjNqNQ_VQ&&jvaqbj.IjNqNQ_VQ.EbyybssCnary>-1)IjPnapryZbhfrYvfgrareNQ_VQ();vs(jvaqbj.IjNqNQ_VQ)jvaqbj.IjNqNQ_VQ.EbyybssCnary=c;gel{vs(q.nqqRiragYvfgrare)q.nqqRiragYvfgrare(z,s,snyfr);ryfr vs(q.nggnpuRirag)q.nggnpuRirag("ba"+z,s);}pngpu(r){}};;jvaqbj.IjPnapryZbhfrYvfgrareNQ_VQ=shapgvba(){ine z="zbhfrzbir",q=qbphzrag,s=IjPurpxZbhfrCbfvgvbaNQ_VQ;vs(jvaqbj.IjNqNQ_VQ)jvaqbj.IjNqNQ_VQ.EbyybssCnary=-1;gel{vs(q.erzbirRiragYvfgrare)q.erzbirRiragYvfgrare(z,s,snyfr);ryfr vs(q.qrgnpuRirag)q.qrgnpuRirag("ba"+z,s);}pngpu(r){}};;jvaqbj.IjNqNQ_VQ.IjTc=d2(n,c){ine nq=jvaqbj.IjNqNQ_VQ;vs(vfAnA(c)){sbe(ine v=0;v0){vs(nq.FzV.yratgu>0)nq.FzV+="/";nq.FzV+=vh[v];nq.FtZ[nq.FtZ.yratgu]=snyfr;}}};;jvaqbj.IjNqNQ_VQ.IjYvzvg0=d2(n,f){ine nq=jvaqbj.IjNqNQ_VQ,vh=f.fcyvg("/");sbe(ine v=0;v0){vs(nq.OvC.yratgu>0)nq.OvC+="/";nq.OvC+=vh[v];}}};;jvaqbj.IjNqNQ_VQ.IjRVST=d2(n,c){jvaqbj["IjCnayNQ_VQ_"+c+"_Bow"]=IjTrgBow("IjCnayNQ_VQ_"+c+"_Bow");vs(jvaqbj["IjCnayNQ_VQ_"+c+"_Bow"]==ahyy)frgGvzrbhg("IjRVST(NQ_VQ,"+c+")",jvaqbj.IjNqNQ_VQ.rvsg);};;jvaqbj.IjNqNQ_VQ.IjNavzSHC=d2(n,c){ine nq=jvaqbj.IjNqNQ_VQ;vs(c>nq.Cnaryf.yratgu)erghea;ine cna=nq.Cnaryf[c],nn=gehr,on=gehr,yn=gehr,en=gehr,cn=nq.Cnaryf[0],sf=nq.ShF,j=cn.Jvqgu,u=cn.Urvtug;vs(j=="100%"){j=sf;en=snyfr;yn=snyfr;}vs(u=="100%"){u=sf;nn=snyfr;on=snyfr;}vs(cn.YnY=="Y")yn=snyfr;vs(cn.YnY=="E")en=snyfr;vs(cn.GnY=="G")nn=snyfr;vs(cn.GnY=="O")on=snyfr;ine k=0,l=0;fjvgpu(nq.NshP%8){pnfr 0:oernx;pnfr 1:vs(nn)l=-sf;oernx;pnfr 2:k=j-sf;oernx;pnfr 3:vs(en)k=j;oernx;pnfr 4:k=j-sf;l=u-sf;oernx;pnfr 5:k=j-sf;vs(on)l=u;oernx;pnfr 6:l=u-sf;oernx;pnfr 7:vs(yn)k=-sf;l=u-sf;oernx;}vs(nq.NshP++ 0)||(nethzragf.yratgu==3&&bG>0))){pyrneGvzrbhg(cay.UgU);cay.UgU=frgGvzrbhg(cay.UvqrNpgvba,(nethzragf.yratgu==3?bG:cay.UvqrGvzrbhgInyhr));}};;jvaqbj.IjNqNQ_VQ.IjErfrgGvzrbhg=d2(n,c,bG){c=IjTc(n,c);IjPnapryGvzrbhg(n,c);riny("IjFgnegGvzrbhg(NQ_VQ,c"+(nethzragf.yratgu==3?",bG":"")+")");};;jvaqbj.IjNqNQ_VQ.IjErfrgNyyGvzrbhgf=d2(n){sbe(ine c=0;c##yv4##Cbjreshy Zvpebfbsg grpuabybtl urycf svtug fcnz naq vzcebir frphevgl.##yv19##Trg zber qbar gunaxf gb terngre rnfr naq fcrrq.##yv16##Ybgf bs fgbentr (5 TO) - zber pbby fghss ba gur jnl.##OE## ##OE## ##N##Yrnea zber##/N##', + r'Cbjreshy Zvpebfbsg grpuabybtl urycf svtug fcnz naq vzcebir frphevgl.##yv19##Trg zber qbar gunaxf gb terngre rnfr naq fcrrq.##yv16##Ybgf bs fgbentr (5 TO) - zber pbby fghss ba gur jnl.##OE## ##OE## ##N##Yrnea zber##/N##', + r'Cbjreshy Zvpebfbsg grpuabybtl urycf svtug fcnz naq vzcebir frphevgl.##yv19##Trg zber qbar gunaxf gb terngre rnfr naq fcrrq.Ybgf bs fgbentr (5 TO) - zber pbby fghss ba gur jnl.##OE## ##OE## ##N##Yrnea zber##/N##', + r'Cbjreshy Zvpebfbsg grpuabybtl urycf svtug fcnz naq vzcebir frphevgl.Trg zber qbar gunaxf gb terngre rnfr naq fcrrq.Ybgf bs fgbentr (5 TO) - zber pbby fghss ba gur jnl.##OE## ##OE## ##N##Yrnea zber##/N##', + r'Cbjreshy Zvpebfbsg grpuabybtl urycf svtug fcnz naq vzcebir frphevgl.Trg zber qbar gunaxf gb terngre rnfr naq fcrrq.Ybgf bs fgbentr (5 TO) - zber pbby fghss ba gur jnl. ##N##Yrnea zber##/N##', + r'Cbjreshy Zvpebfbsg grpuabybtl urycf svtug fcnz naq vzcebir frphevgl.Trg zber qbar gunaxf gb terngre rnfr naq fcrrq.Ybgf bs fgbentr (5 TO) - zber pbby fghss ba gur jnl. Yrnea zber##/N##', + r'Bar Jvaqbjf Yvir VQ trgf lbh vagb Ubgznvy, Zrffratre, Kobk YVIR \u2014 naq bgure cynprf lbh frr #~#argjbexybtb#~#', + r'${1}://${2}${3}${4}${5}', + r' O=6gnyg0g4znrrn&o=3&f=gc; Q=_lyu=K3bQZGSxnT4lZzD3OS9GNmV3ZGLkAQxRpTyxNmRlZmRmAmNkAQLRqTImqNZjOUEgpTjQnJ5xMKtgoN--; SCF=qy', + r'FrffvbaQQS2=4ss747o77904333q374or84qrr1s9r0nprp8r5q81534o94n; ZFPhygher=VC=74.125.75.20&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669321699093060&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R=; AFP_zp_tfwsbrg-aowb_80=4413268q3660', + r'FrffvbaQQS2=4ss747o77904333q374or84qrr1s9r0nprp8r5q81534o94n; AFP_zp_tfwsbrg-aowb_80=4413268q3660; __hgzm=144631658.1231364074.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar); __hgzn=144631658.2294274870215848400.1231364074.1231364074.1231364074.1; __hgzo=144631658.0.10.1231364074; __hgzp=144631658; ZFPhygher=VC=74.125.75.20&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669321699093060&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q', + r'uggc://tbbtyrnqf.t.qbhoyrpyvpx.arg/cntrnq/nqf?pyvrag=pn-svz_zlfcnpr_zlfcnpr-ubzrcntr_wf&qg=1231364057761&uy=ra&nqfnsr=uvtu&br=hgs8&ahz_nqf=4&bhgchg=wf&nqgrfg=bss&pbeeryngbe=1231364057761&punaary=svz_zlfcnpr_ubzrcntr_abgybttrqva%2Psvz_zlfcnpr_aba_HTP%2Psvz_zlfcnpr_havgrq-fgngrf&hey=uggc%3N%2S%2Ssevraqf.zlfcnpr.pbz%2Svaqrk.psz&nq_glcr=grkg&rvq=6083027&rn=0&sez=0&tn_ivq=1667363813.1231364061&tn_fvq=1231364061&tn_uvq=1917563877&synfu=9.0.115&h_u=768&h_j=1024&h_nu=738&h_nj=1024&h_pq=24&h_gm=-480&h_uvf=2&h_wnin=gehr&h_acyht=7&h_azvzr=22', + r'ZFPhygher=VC=74.125.75.20&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669321699093060&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q', + r'ZFPhygher=VC=74.125.75.20&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669321699093060&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R=', + r'uggc://cebsvyr.zlfcnpr.pbz/Zbqhyrf/Nccyvpngvbaf/Cntrf/Pnainf.nfck', + r'FrffvbaQQS2=473qq1rs0n2r70q9qo1pq48n021s9468ron90nps048p4p29; ZFPhygher=VC=74.125.75.3&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669325184628362&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R=', + r'FrffvbaQQS2=473qq1rs0n2r70q9qo1pq48n021s9468ron90nps048p4p29; __hgzm=144631658.1231364380.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar); __hgzn=144631658.3931862196947939300.1231364380.1231364380.1231364380.1; __hgzo=144631658.0.10.1231364380; __hgzp=144631658; ZFPhygher=VC=74.125.75.3&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669325184628362&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q', + r'uggc://tbbtyrnqf.t.qbhoyrpyvpx.arg/cntrnq/nqf?pyvrag=pn-svz_zlfcnpr_vzntrf_wf&qg=1231364373088&uy=ra&nqfnsr=uvtu&br=hgs8&ahz_nqf=4&bhgchg=wf&nqgrfg=bss&pbeeryngbe=1231364373088&punaary=svz_zlfcnpr_hfre-ivrj-pbzzragf%2Psvz_zlfcnpr_havgrq-fgngrf&hey=uggc%3N%2S%2Spbzzrag.zlfcnpr.pbz%2Svaqrk.psz&nq_glcr=grkg&rvq=6083027&rn=0&sez=0&tn_ivq=1158737789.1231364375&tn_fvq=1231364375&tn_uvq=415520832&synfu=9.0.115&h_u=768&h_j=1024&h_nu=738&h_nj=1024&h_pq=24&h_gm=-480&h_uvf=2&h_wnin=gehr&h_acyht=7&h_azvzr=22', + r'ZFPhygher=VC=74.125.75.3&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669325184628362&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q', + r'ZFPhygher=VC=74.125.75.3&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669325184628362&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R=', + r'#Zbq-Vasb-Vasb-WninFpevcgUvag', + r',n.svryqOgaPnapry', + r'FrffvbaQQS2=p98s8o9q42nr21or1r61pqorn1n002nsss569635984s6qp7; ZFPhygher=VC=74.125.75.3&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669357391353591&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R=; AFP_zp_kkk-gdzogv_80=4413241q3660', + r'FrffvbaQQS2=p98s8o9q42nr21or1r61pqorn1n002nsss569635984s6qp7; AFP_zp_kkk-gdzogv_80=4413241q3660; AFP_zp_kkk-aowb_80=4413235p3660; __hgzm=144631658.1231367708.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar); __hgzn=144631658.2770915348920628700.1231367708.1231367708.1231367708.1; __hgzo=144631658.0.10.1231367708; __hgzp=144631658; ZFPhygher=VC=74.125.75.3&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669357391353591&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q', + r'uggc://tbbtyrnqf.t.qbhoyrpyvpx.arg/cntrnq/nqf?pyvrag=pn-svz_zlfcnpr_zlfcnpr-ubzrcntr_wf&qg=1231367691141&uy=ra&nqfnsr=uvtu&br=hgs8&ahz_nqf=4&bhgchg=wf&nqgrfg=bss&pbeeryngbe=1231367691141&punaary=svz_zlfcnpr_ubzrcntr_abgybttrqva%2Psvz_zlfcnpr_aba_HTP%2Psvz_zlfcnpr_havgrq-fgngrf&hey=uggc%3N%2S%2Sjjj.zlfcnpr.pbz%2S&nq_glcr=grkg&rvq=6083027&rn=0&sez=0&tn_ivq=320757904.1231367694&tn_fvq=1231367694&tn_uvq=1758792003&synfu=9.0.115&h_u=768&h_j=1024&h_nu=738&h_nj=1024&h_pq=24&h_gm=-480&h_uvf=2&h_wnin=gehr&h_acyht=7&h_azvzr=22', + r'uggc://zfacbegny.112.2b7.arg/o/ff/zfacbegnyubzr/1/U.7-cqi-2/f55332979829981?[NDO]&aqu=1&g=7%2S0%2S2009%2014%3N38%3N42%203%20480&af=zfacbegny&cntrAnzr=HF%20UCZFSGJ&t=uggc%3N%2S%2Sjjj.zfa.pbz%2S&f=1024k768&p=24&x=L&oj=994&ou=634&uc=A&{2}&[NDR]', + r'cnerag puebzr6 fvatyr1 gno fryrpgrq ovaq qbhoyr2 ps', + r'ZFPhygher=VC=74.125.75.3&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669357391353591&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q', + r'ZFPhygher=VC=74.125.75.3&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669357391353591&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R=', + r'ne;ng;nh;or;oe;pn;pu;py;pa;qr;qx;rf;sv;se;to;ux;vq;vr;va;vg;wc;xe;zk;zl;ay;ab;am;cu;cy;cg;eh;fr;ft;gu;ge;gj;mn;', + r'ZP1=I=3&THVQ=6nnpr9q661804s33nnop45nosqp17q85; zu=ZFSG; PHYGHER=RA-HF; SyvtugTebhcVq=97; SyvtugVq=OnfrCntr; ucfie=Z:5|S:5|G:5|R:5|Q:oyh|J:S; ucpyv=J.U|Y.|F.|E.|H.Y|P.|U.; hfucjrn=jp:HFPN0746; ZHVQ=Q783SN9O14054831N4869R51P0SO8886&GHVQ=1', + r'ZP1=I=3&THVQ=6nnpr9q661804s33nnop45nosqp17q85; zu=ZFSG; PHYGHER=RA-HF; SyvtugTebhcVq=97; SyvtugVq=OnfrCntr; ucfie=Z:5|S:5|G:5|R:5|Q:oyh|J:S; ucpyv=J.U|Y.|F.|E.|H.Y|P.|U.; hfucjrn=jp:HFPN0746; ZHVQ=Q783SN9O14054831N4869R51P0SO8886', + r'ZP1=I=3&THVQ=6nnpr9q661804s33nnop45nosqp17q85; zu=ZFSG; PHYGHER=RA-HF; SyvtugTebhcVq=97; SyvtugVq=OnfrCntr; ucfie=Z:5|S:5|G:5|R:5|Q:oyh|J:S; ucpyv=J.U|Y.|F.|E.|H.Y|P.|U.; hfucjrn=jp:HFPN0746; ZHVQ=Q783SN9O14054831N4869R51P0SO8886; mvc=m:94043|yn:37.4154|yb:-122.0585|p:HF|ue:1', + r'ZP1=I=3&THVQ=6nnpr9q661804s33nnop45nosqp17q85; zu=ZFSG; PHYGHER=RA-HF; SyvtugTebhcVq=97; SyvtugVq=OnfrCntr; ucfie=Z:5|S:5|G:5|R:5|Q:oyh|J:S; ucpyv=J.U|Y.|F.|E.|H.Y|P.|U.; hfucjrn=jp:HFPN0746; ZHVQ=Q783SN9O14054831N4869R51P0SO8886; mvc=m:94043|yn:37.4154|yb:-122.0585|p:HF', + r'uggc://gx2.fgp.f-zfa.pbz/oe/uc/11/ra-hf/pff/v/g.tvs#uggc://gx2.fgo.f-zfa.pbz/v/29/4RQP4969777N048NPS4RRR3PO2S7S.wct', + r'uggc://gx2.fgp.f-zfa.pbz/oe/uc/11/ra-hf/pff/v/g.tvs#uggc://gx2.fgo.f-zfa.pbz/v/OQ/63NP9O94NS5OQP1249Q9S1ROP7NS3.wct', + r'zbmvyyn/5.0 (jvaqbjf; h; jvaqbjf ag 5.1; ra-hf) nccyrjroxvg/528.9 (xugzy, yvxr trpxb) puebzr/2.0.157.0 fnsnev/528.9', + r'1231365729213', + r'74.125.75.3-1057165600.29978900', + r'74.125.75.3-1057165600.29978900.1231365730214', + r'Frnepu%20Zvpebfbsg.pbz', + r'FrffvbaQQS2=8sqq78r9n442851q565599o401385sp3s04r92rnn7o19ssn; ZFPhygher=VC=74.125.75.17&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669340386893867&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R=', + r'FrffvbaQQS2=8sqq78r9n442851q565599o401385sp3s04r92rnn7o19ssn; __hgzm=144631658.1231365779.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar); __hgzn=144631658.1877536177953918500.1231365779.1231365779.1231365779.1; __hgzo=144631658.0.10.1231365779; __hgzp=144631658; ZFPhygher=VC=74.125.75.17&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669340386893867&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q', + r'I=3%26THVQ=757q3ss871q44o7o805n8113n5p72q52', + r'I=3&THVQ=757q3ss871q44o7o805n8113n5p72q52', + r'uggc://tbbtyrnqf.t.qbhoyrpyvpx.arg/cntrnq/nqf?pyvrag=pn-svz_zlfcnpr_zlfcnpr-ubzrcntr_wf&qg=1231365765292&uy=ra&nqfnsr=uvtu&br=hgs8&ahz_nqf=4&bhgchg=wf&nqgrfg=bss&pbeeryngbe=1231365765292&punaary=svz_zlfcnpr_ubzrcntr_abgybttrqva%2Psvz_zlfcnpr_aba_HTP%2Psvz_zlfcnpr_havgrq-fgngrf&hey=uggc%3N%2S%2Sohyyrgvaf.zlfcnpr.pbz%2Svaqrk.psz&nq_glcr=grkg&rvq=6083027&rn=0&sez=0&tn_ivq=1579793869.1231365768&tn_fvq=1231365768&tn_uvq=2056210897&synfu=9.0.115&h_u=768&h_j=1024&h_nu=738&h_nj=1024&h_pq=24&h_gm=-480&h_uvf=2&h_wnin=gehr&h_acyht=7&h_azvzr=22', + r'frnepu.zvpebfbsg.pbz', + r'frnepu.zvpebfbsg.pbz/', + r'ZFPhygher=VC=74.125.75.17&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669340386893867&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q', + r'ZFPhygher=VC=74.125.75.17&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669340386893867&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R=', + r'#fubhgobk .pybfr', + r'FrffvbaQQS2=102n9o0o9pq60132qn0337rr867p75953502q2s27s2s5r98; ZFPhygher=VC=74.125.75.1&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669341278771470&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R=; AFP_zp_dfctwzssrwh-aowb_80=441326q33660', + r'FrffvbaQQS2=102n9o0o9pq60132qn0337rr867p75953502q2s27s2s5r98; AFP_zp_dfctwzssrwh-aowb_80=441326q33660; __hgzm=144631658.1231365869.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar); __hgzn=144631658.1670816052019209000.1231365869.1231365869.1231365869.1; __hgzo=144631658.0.10.1231365869; __hgzp=144631658; ZFPhygher=VC=74.125.75.1&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669341278771470&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q', + r'FrffvbaQQS2=9995p6rp12rrnr893334ro7nq70o7p64p69rqn844prs1473; ZFPhygher=VC=74.125.75.1&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669350559478880&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R=; AFP_zp_dfctwzs-aowb_80=441327q73660', + r'FrffvbaQQS2=9995p6rp12rrnr893334ro7nq70o7p64p69rqn844prs1473; AFP_zp_dfctwzs-aowb_80=441327q73660; __hgzm=144631658.1231367054.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar); __hgzn=144631658.1796080716621419500.1231367054.1231367054.1231367054.1; __hgzo=144631658.0.10.1231367054; __hgzp=144631658; ZFPhygher=VC=74.125.75.1&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669350559478880&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q', + r'[glcr=fhozvg]', + r'n.svryqOga,n.svryqOgaPnapry', + r'n.svryqOgaPnapry', + r'oyvpxchaxg', + r'qvi.bow-nppbeqvba qg', + r'uggc://tbbtyrnqf.t.qbhoyrpyvpx.arg/cntrnq/nqf?pyvrag=pn-svz_zlfcnpr_nccf_wf&qg=1231367052227&uy=ra&nqfnsr=uvtu&br=hgs8&ahz_nqf=4&bhgchg=wf&nqgrfg=bss&pbeeryngbe=1231367052227&punaary=svz_zlfcnpr_nccf-pnainf%2Psvz_zlfcnpr_havgrq-fgngrf&hey=uggc%3N%2S%2Scebsvyr.zlfcnpr.pbz%2SZbqhyrf%2SNccyvpngvbaf%2SCntrf%2SPnainf.nfck&nq_glcr=grkg&rvq=6083027&rn=0&sez=1&tn_ivq=716357910.1231367056&tn_fvq=1231367056&tn_uvq=1387206491&synfu=9.0.115&h_u=768&h_j=1024&h_nu=738&h_nj=1024&h_pq=24&h_gm=-480&h_uvf=2&h_wnin=gehr&h_acyht=7&h_azvzr=22', + r'uggc://tbbtyrnqf.t.qbhoyrpyvpx.arg/cntrnq/nqf?pyvrag=pn-svz_zlfcnpr_zlfcnpr-ubzrcntr_wf&qg=1231365851658&uy=ra&nqfnsr=uvtu&br=hgs8&ahz_nqf=4&bhgchg=wf&nqgrfg=bss&pbeeryngbe=1231365851658&punaary=svz_zlfcnpr_ubzrcntr_abgybttrqva%2Psvz_zlfcnpr_aba_HTP%2Psvz_zlfcnpr_havgrq-fgngrf&hey=uggc%3N%2S%2Scebsvyrrqvg.zlfcnpr.pbz%2Svaqrk.psz&nq_glcr=grkg&rvq=6083027&rn=0&sez=0&tn_ivq=1979828129.1231365855&tn_fvq=1231365855&tn_uvq=2085229649&synfu=9.0.115&h_u=768&h_j=1024&h_nu=738&h_nj=1024&h_pq=24&h_gm=-480&h_uvf=2&h_wnin=gehr&h_acyht=7&h_azvzr=22', + r'uggc://zfacbegny.112.2b7.arg/o/ff/zfacbegnyubzr/1/U.7-cqi-2/f55023338617756?[NDO]&aqu=1&g=7%2S0%2S2009%2014%3N12%3N47%203%20480&af=zfacbegny&cntrAnzr=HF%20UCZFSGJ&t=uggc%3N%2S%2Sjjj.zfa.pbz%2S&f=0k0&p=43835816&x=A&oj=994&ou=634&uc=A&{2}&[NDR]', + r'zrgn[anzr=nwnkHey]', + r'anpuevpugra', + r'b oS={\'oT\':1.1};x $8n(B){z(B!=o9)};x $S(B){O(!$8n(B))z A;O(B.4L)z\'T\';b S=7t B;O(S==\'2P\'&&B.p4){23(B.7f){12 1:z\'T\';12 3:z/\S/.2g(B.8M)?\'ox\':\'oh\'}}O(S==\'2P\'||S==\'x\'){23(B.nE){12 2V:z\'1O\';12 7I:z\'5a\';12 18:z\'4B\'}O(7t B.I==\'4F\'){O(B.3u)z\'pG\';O(B.8e)z\'1p\'}}z S};x $2p(){b 4E={};Z(b v=0;v<1p.I;v++){Z(b X 1o 1p[v]){b nc=1p[v][X];b 6E=4E[X];O(6E&&$S(nc)==\'2P\'&&$S(6E)==\'2P\')4E[X]=$2p(6E,nc);17 4E[X]=nc}}z 4E};b $E=7p.E=x(){b 1d=1p;O(!1d[1])1d=[p,1d[0]];Z(b X 1o 1d[1])1d[0][X]=1d[1][X];z 1d[0]};b $4D=7p.pJ=x(){Z(b v=0,y=1p.I;v-1:p.3F(2R)>-1},nX:x(){z p.3y(/([.*+?^${}()|[\]\/\\])/t,\'\\$1\')}});2V.E({5V:x(1O){O(p.I<3)z A;O(p.I==4&&p[3]==0&&!1O)z\'p5\';b 3P=[];Z(b v=0;v<3;v++){b 52=(p[v]-0).4h(16);3P.1x((52.I==1)?\'0\'+52:52)}z 1O?3P:\'#\'+3P.2u(\'\')},5U:x(1O){O(p.I!=3)z A;b 1i=[];Z(b v=0;v<3;v++){1i.1x(5K((p[v].I==1)?p[v]+p[v]:p[v],16))}z 1O?1i:\'1i(\'+1i.2u(\',\')+\')\'}});7F.E({3n:x(P){b J=p;P=$2p({\'L\':J,\'V\':A,\'1p\':1S,\'2x\':A,\'4s\':A,\'6W\':A},P);O($2O(P.1p)&&$S(P.1p)!=\'1O\')P.1p=[P.1p];z x(V){b 1d;O(P.V){V=V||H.V;1d=[(P.V===1r)?V:Y P.V(V)];O(P.1p)1d.E(P.1p)}17 1d=P.1p||1p;b 3C=x(){z J.3H($5S(P', + r'hagreunyghat', + r'ZFPhygher=VC=74.125.75.1&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669341278771470&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q', + r'ZFPhygher=VC=74.125.75.1&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669350559478880&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q', + r'ZFPhygher=VC=74.125.75.1&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669341278771470&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R=', + r'ZFPhygher=VC=74.125.75.1&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669350559478880&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R=', + r'shapgvba (){Cuk.Nccyvpngvba.Frghc.Pber();Cuk.Nccyvpngvba.Frghc.Nwnk();Cuk.Nccyvpngvba.Frghc.Synfu();Cuk.Nccyvpngvba.Frghc.Zbqhyrf()}'] + +# The 12 benchmarking blocks + + +def block0(): + for i in range(6511): + regexs[0].search(r'pyvpx') + + for i in range(1844): + regexs[1].search(r'uggc://jjj.snprobbx.pbz/ybtva.cuc') + + for i in range(739): + regexs[2].sub(r'', 'QBZPbageby_cynprubyqre', subcount[2]) + + for i in range(598): + regexs[1].search(r'uggc://jjj.snprobbx.pbz/') + + for i in range(454): + regexs[1].search(r'uggc://jjj.snprobbx.pbz/fepu.cuc') + + for i in range(352): + re.search( + r'qqqq|qqq|qq|q|ZZZZ|ZZZ|ZZ|Z|llll|ll|l|uu|u|UU|U|zz|z|ff|f|gg|g|sss|ss|s|mmm|mm|m', 'qqqq, ZZZ q, llll') + + for i in range(312): + regexs[3].search(r'vachggrkg QBZPbageby_cynprubyqre') + + for i in range(282): + regexs[4].search(r'/ZlFcnprUbzrcntr/Vaqrk-FvgrUbzr,10000000') + + for i in range(177): + regexs[5].sub(r'', 'vachggrkg', subcount[5]) + + for i in range(170): + regexs[6].sub(r'', '528.9', subcount[6]) + regexs[7].search(r'528') + + for i in range(156): + regexs[8].search(r'VCPhygher=ra-HF') + regexs[8].search(r'CersreerqPhygher=ra-HF') + + for i in range(144): + regexs[0].search(r'xrlcerff') + + for i in range(139): + regexs[6].sub(r'', '521', subcount[6]) + + # This has a different output to the V8 version. + # It could just be a difference in the engines. + regexs[7].search(r'521') + regexs[9].search(r'') + re.search(r'JroXvg\/(\S+)', strings[0]) + + for i in range(137): + regexs[10].sub(r'', 'qvi .so_zrah', subcount[10]) + re.sub(r'\[', '', 'qvi .so_zrah', 0) + regexs[11].sub(r'', 'qvi.so_zrah', subcount[11]) + + for i in range(117): + regexs[2].sub(r'', 'uvqqra_ryrz', subcount[2]) + + for i in range(95): + re.search(r'(?:^|;)\s*sevraqfgre_ynat=([^;]*)', + 'sevraqfgre_naba=nvq%3Qn6ss9p85n868ro9s059pn854735956o3%26ers%3Q%26df%3Q%26vpgl%3QHF') + + for i in range(93): + regexs[12].sub(r'', 'uggc://ubzr.zlfcnpr.pbz/vaqrk.psz', subcount[12]) + regexs[13].search(r'uggc://ubzr.zlfcnpr.pbz/vaqrk.psz') + + for i in range(92): + re.sub(r'([a-zA-Z]|\s)+', '', strings[1], 1) + + for i in range(85): + regexs[14].sub(r'', 'svefg', subcount[14]) + regexs[15].sub(r'', 'svefg', subcount[15]) + regexs[12].sub( + r'', 'uggc://cebsvyr.zlfcnpr.pbz/vaqrk.psz', subcount[12]) + regexs[14].sub(r'', 'ynfg', subcount[14]) + regexs[15].sub(r'', 'ynfg', subcount[15]) + regexs[16].search(r'qvfcynl') + regexs[13].search(r'uggc://cebsvyr.zlfcnpr.pbz/vaqrk.psz') + + +def block1(): + for i in range(81): + regexs[8].search(r'VC=74.125.75.1') + + for i in range(78): + re.sub(r'(\s)+e', '', '9.0 e115', 1) + re.sub(r'.', '', 'k', 1) + + # This prints a unicode escape where the V8 version prints the + # unicode character. + regexs[17].sub(r'', strings[2], subcount[17]) + + # This prints a unicode escape where the V8 version prints the + # unicode character. + regexs[17].sub(r'', strings[3], subcount[17]) + + regexs[8].search(r'144631658') + regexs[8].search(r'Pbhagel=IIZ%3Q') + regexs[8].search(r'Pbhagel=IIZ=') + regexs[8].search(r'CersreerqPhygherCraqvat=') + regexs[8].search(strings[4]) + regexs[8].search(strings[5]) + regexs[8].search(r'__hgzp=144631658') + regexs[8].search(r'gvzrMbar=-8') + regexs[8].search(r'gvzrMbar=0') + re.search(r'Fnsnev\/(\d+\.\d+)', strings[0]) + regexs[3].search(r'vachggrkg QBZPbageby_cynprubyqre') + regexs[0].search(r'xrlqbja') + regexs[0].search(r'xrlhc') + + for i in range(77): + regexs[12].sub( + r'', 'uggc://zrffntvat.zlfcnpr.pbz/vaqrk.psz', subcount[12]) + regexs[13].search(r'uggc://zrffntvat.zlfcnpr.pbz/vaqrk.psz') + + for i in range(73): + regexs[18].sub( + r'', 'FrffvbaFgbentr=%7O%22GnoThvq%22%3N%7O%22thvq%22%3N1231367125017%7Q%7Q', subcount[18]) + + for i in range(72): + regexs[1].search(strings[6]) + + for i in range(71): + regexs[19].search(r'') + + for i in range(70): + regexs[11].sub(r'', '3.5.0.0', subcount[11]) + re.sub(r'd1', '', strings[7], 0) + re.sub(r'NQ_VQ', '', strings[8], 0) + re.sub(r'd2', '', strings[9], 0) + re.sub( + r'_', '', 'NI%3Q1_CI%3Q1_PI%3Q1_EI%3Q1_HI%3Q1_HP%3Q1_IC%3Q0.0.0.0_IH%3Q0', 0) + regexs[20].split( + r'svz_zlfcnpr_ubzrcntr_abgybttrqva,svz_zlfcnpr_aba_HTP,svz_zlfcnpr_havgrq-fgngrf') + regexs[21].search(r'ybnqvat') + + for i in range(68): + regexs[1].search(r'#') + re.search( + r'(?:ZFVR.(\d+\.\d+))|(?:(?:Sversbk|TenaCnenqvfb|Vprjrnfry).(\d+\.\d+))|(?:Bcren.(\d+\.\d+))|(?:NccyrJroXvg.(\d+(?:\.\d+)?))', strings[0]) + re.search(r'(Znp BF K)|(Jvaqbjf;)', strings[0]) + re.search(r'Trpxb\/([0-9]+)', strings[0]) + regexs[21].search(r'ybnqrq') + + for i in range(49): + regexs[16].search(r'pbybe') + + for i in range(44): + regexs[12].sub( + r'', 'uggc://sevraqf.zlfcnpr.pbz/vaqrk.psz', subcount[12]) + regexs[13].search(r'uggc://sevraqf.zlfcnpr.pbz/vaqrk.psz') + + +def block2(): + for i in range(40): + regexs[14].sub(r'', 'fryrpgrq', subcount[14]) + regexs[15].sub(r'', 'fryrpgrq', subcount[15]) + + for i in range(39): + re.sub(r'\buvqqra_ryrz\b', '', 'vachggrkg uvqqra_ryrz', 0) + regexs[3].search(r'vachggrkg ') + regexs[3].search(r'vachggrkg') + regexs[22].search(r'HVYvaxOhggba') + regexs[22].search(r'HVYvaxOhggba_E') + regexs[22].search(r'HVYvaxOhggba_EJ') + regexs[22].search(r'zrah_ybtva_pbagnvare') + re.search(r'\buvqqra_ryrz\b', 'vachgcnffjbeq') + + for i in range(37): + regexs[8].search(r'111soqs57qo8o8480qo18sor2011r3n591q7s6s37r120904') + regexs[8].search(r'SbeprqRkcvengvba=633669315660164980') + regexs[8].search( + r'FrffvbaQQS2=111soqs57qo8o8480qo18sor2011r3n591q7s6s37r120904') + + for i in range(35): + regexs[14].sub(r'', 'puvyq p1 svefg', subcount[14]) + regexs[15].sub(r'', 'puvyq p1 svefg', subcount[15]) + regexs[14].sub(r'', 'sylbhg pybfrq', subcount[14]) + regexs[15].sub(r'', 'sylbhg pybfrq', subcount[15]) + + for i in range(34): + regexs[19].search(r'gno2') + regexs[19].search(r'gno3') + regexs[8].search(r'44132r503660') + regexs[8].search(r'SbeprqRkcvengvba=633669316860113296') + regexs[8].search(r'AFP_zp_dfctwzs-aowb_80=44132r503660') + regexs[8].search( + r'FrffvbaQQS2=s6r4579npn4rn2135s904r0s75pp1o5334p6s6pospo12696') + regexs[8].search(r's6r4579npn4rn2135s904r0s75pp1o5334p6s6pospo12696') + + for i in range(32): + re.search(r'puebzr', strings[0], re.IGNORECASE) + + for i in range(31): + regexs[23].sub(r'', 'uggc://jjj.snprobbx.pbz/', subcount[23]) + regexs[8].search(r'SbeprqRkcvengvba=633669358527244818') + regexs[8].search(r'VC=66.249.85.130') + regexs[8].search( + r'FrffvbaQQS2=s15q53p9n372sn76npr13o271n4s3p5r29p235746p908p58') + regexs[8].search(r's15q53p9n372sn76npr13o271n4s3p5r29p235746p908p58') + regexs[24].search(r'uggc://jjj.snprobbx.pbz/') + + for i in range(30): + regexs[6].sub(r'', '419', subcount[6]) + re.search(r'(?:^|\s+)gvzrfgnzc(?:\s+|$)', 'gvzrfgnzc') + regexs[7].search(r'419') + + for i in range(29): + regexs[23].sub(r'', 'uggc://jjj.snprobbx.pbz/ybtva.cuc', subcount[23]) + + for i in range(28): + regexs[25].sub(r'', 'Funer guvf tnqtrg', subcount[25]) + regexs[12].sub(r'', 'Funer guvf tnqtrg', subcount[12]) + regexs[26].search(r'uggc://jjj.tbbtyr.pbz/vt/qverpgbel') + + +def block3(): + for i in range(27): + re.sub(r'[A-Za-z]', '', 'e115', 0) + + for i in range(23): + regexs[27].sub(r'', 'qvfcynl', subcount[27]) + regexs[27].sub(r'', 'cbfvgvba', subcount[27]) + + for i in range(22): + regexs[14].sub(r'', 'unaqyr', subcount[14]) + regexs[15].sub(r'', 'unaqyr', subcount[15]) + regexs[14].sub(r'', 'yvar', subcount[14]) + regexs[15].sub(r'', 'yvar', subcount[15]) + regexs[14].sub(r'', 'cnerag puebzr6 fvatyr1 gno', subcount[14]) + regexs[15].sub(r'', 'cnerag puebzr6 fvatyr1 gno', subcount[15]) + regexs[14].sub(r'', 'fyvqre', subcount[14]) + regexs[15].sub(r'', 'fyvqre', subcount[15]) + regexs[28].search(r'') + + for i in range(21): + regexs[12].sub(r'', 'uggc://jjj.zlfcnpr.pbz/', subcount[12]) + regexs[13].search(r'uggc://jjj.zlfcnpr.pbz/') + + for i in range(20): + regexs[29].sub(r'', 'cntrivrj', subcount[29]) + regexs[30].sub(r'', 'cntrivrj', subcount[30]) + regexs[19].search(r'ynfg') + regexs[19].search(r'ba svefg') + regexs[8].search(r'VC=74.125.75.3') + + for i in range(19): + regexs[31].search(r'ra') + + for i in range(18): + regexs[32].split(strings[10]) + regexs[32].split(strings[11]) + regexs[33].sub(r'', strings[12], subcount[33]) + regexs[8].search(r'144631658.0.10.1231363570') + regexs[8].search( + r'144631658.1231363570.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)') + regexs[8].search( + r'144631658.3426875219718084000.1231363570.1231363570.1231363570.1') + regexs[8].search(strings[13]) + regexs[8].search(strings[14]) + regexs[8].search( + r'__hgzn=144631658.3426875219718084000.1231363570.1231363570.1231363570.1') + regexs[8].search(r'__hgzo=144631658.0.10.1231363570') + regexs[8].search( + r'__hgzm=144631658.1231363570.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)') + regexs[34].search(strings[10]) + regexs[34].search(strings[11]) + + for i in range(17): + re.match(r'zfvr', strings[0], re.IGNORECASE) + re.match(r'bcren', strings[0], re.IGNORECASE) + regexs[32].split(strings[15]) + regexs[32].split(strings[16]) + regexs[14].sub(r'', 'ohggba', subcount[14]) + regexs[15].sub(r'', 'ohggba', subcount[15]) + regexs[14].sub(r'', 'puvyq p1 svefg sylbhg pybfrq', subcount[14]) + regexs[15].sub(r'', 'puvyq p1 svefg sylbhg pybfrq', subcount[15]) + regexs[14].sub(r'', 'pvgvrf', subcount[14]) + regexs[15].sub(r'', 'pvgvrf', subcount[15]) + regexs[14].sub(r'', 'pybfrq', subcount[14]) + regexs[15].sub(r'', 'pybfrq', subcount[15]) + regexs[14].sub(r'', 'qry', subcount[14]) + regexs[15].sub(r'', 'qry', subcount[15]) + regexs[14].sub(r'', 'uqy_zba', subcount[14]) + regexs[15].sub(r'', 'uqy_zba', subcount[15]) + regexs[33].sub(r'', strings[17], subcount[33]) + re.sub(r'%3P', '', strings[18], 0) + re.sub(r'%3R', '', strings[18], 0) + re.sub(r'%3q', '', strings[18], 0) + regexs[35].sub(r'', strings[18], subcount[35]) + regexs[14].sub(r'', 'yvaxyvfg16', subcount[14]) + regexs[15].sub(r'', 'yvaxyvfg16', subcount[15]) + regexs[14].sub(r'', 'zvahf', subcount[14]) + regexs[15].sub(r'', 'zvahf', subcount[15]) + regexs[14].sub(r'', 'bcra', subcount[14]) + regexs[15].sub(r'', 'bcra', subcount[15]) + regexs[14].sub(r'', 'cnerag puebzr5 fvatyr1 ps NU', subcount[14]) + regexs[15].sub(r'', 'cnerag puebzr5 fvatyr1 ps NU', subcount[15]) + regexs[14].sub(r'', 'cynlre', subcount[14]) + regexs[15].sub(r'', 'cynlre', subcount[15]) + regexs[14].sub(r'', 'cyhf', subcount[14]) + regexs[15].sub(r'', 'cyhf', subcount[15]) + regexs[14].sub(r'', 'cb_uqy', subcount[14]) + regexs[15].sub(r'', 'cb_uqy', subcount[15]) + regexs[14].sub(r'', 'hyJVzt', subcount[14]) + regexs[15].sub(r'', 'hyJVzt', subcount[15]) + regexs[8].search(r'144631658.0.10.1231363638') + regexs[8].search( + r'144631658.1231363638.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)') + regexs[8].search( + r'144631658.965867047679498800.1231363638.1231363638.1231363638.1') + regexs[8].search(r'4413268q3660') + regexs[8].search(r'4ss747o77904333q374or84qrr1s9r0nprp8r5q81534o94n') + regexs[8].search(r'SbeprqRkcvengvba=633669321699093060') + regexs[8].search(r'VC=74.125.75.20') + regexs[8].search(strings[19]) + regexs[8].search(strings[20]) + regexs[8].search(r'AFP_zp_tfwsbrg-aowb_80=4413268q3660') + regexs[8].search( + r'FrffvbaQQS2=4ss747o77904333q374or84qrr1s9r0nprp8r5q81534o94n') + regexs[8].search( + r'__hgzn=144631658.965867047679498800.1231363638.1231363638.1231363638.1') + regexs[8].search(r'__hgzo=144631658.0.10.1231363638') + regexs[8].search( + r'__hgzm=144631658.1231363638.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)') + regexs[34].search(strings[15]) + regexs[34].search(strings[16]) + + +def block4(): + for i in range(16): + re.sub(r'\*', '', '', 0) + re.search(r'\bnpgvir\b', 'npgvir') + re.search(r'sversbk', strings[0], re.IGNORECASE) + regexs[36].search(r'glcr') + re.search(r'zfvr', strings[0], re.IGNORECASE) + re.search(r'bcren', strings[0], re.IGNORECASE) + + for i in range(15): + regexs[32].split(strings[21]) + regexs[32].split(strings[22]) + regexs[12].sub( + r'', 'uggc://ohyyrgvaf.zlfcnpr.pbz/vaqrk.psz', subcount[12]) + regexs[33].sub(r'', strings[23], subcount[33]) + regexs[37].sub(r'', 'yv', subcount[37]) + regexs[18].sub(r'', 'yv', subcount[18]) + regexs[8].search(r'144631658.0.10.1231367822') + regexs[8].search( + r'144631658.1231367822.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)') + regexs[8].search( + r'144631658.4127520630321984500.1231367822.1231367822.1231367822.1') + regexs[8].search(strings[24]) + regexs[8].search(strings[25]) + regexs[8].search( + r'__hgzn=144631658.4127520630321984500.1231367822.1231367822.1231367822.1') + regexs[8].search(r'__hgzo=144631658.0.10.1231367822') + regexs[8].search( + r'__hgzm=144631658.1231367822.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)') + regexs[34].search(strings[21]) + regexs[34].search(strings[22]) + + # FIXME + # The \{0,65534} should be a * + # There's a current python bug that will stop the regex compilation + # when a * appears there http://bugs.python.org/issue6156. + re.search( + r'\.([\w-]+)|\[(\w+)(?:([!*^$~|]?=)["\']?(.*?)["\']?)?\]|:([\w-]+)(?:\(["\']?(.\{0,65534}?)?["\']?\)|$)', strings[26]) + + regexs[13].search(r'uggc://ohyyrgvaf.zlfcnpr.pbz/vaqrk.psz') + regexs[38].search(r'yv') + + for i in range(14): + regexs[18].sub(r'', '', subcount[18]) + re.sub(r'(\s+e|\s+o[0-9]+)', '', '9.0 e115', 1) + re.sub(r'<', '', 'Funer guvf tnqtrg', 0) + re.sub(r'>', '', 'Funer guvf tnqtrg', 0) + regexs[39].sub(r'', 'Funer guvf tnqtrg', subcount[39]) + regexs[12].sub( + r'', 'uggc://cebsvyrrqvg.zlfcnpr.pbz/vaqrk.psz', subcount[12]) + regexs[40].sub(r'', 'grnfre', subcount[40]) + regexs[41].sub(r'', 'grnfre', subcount[41]) + regexs[42].sub(r'', 'grnfre', subcount[42]) + regexs[43].sub(r'', 'grnfre', subcount[43]) + regexs[44].sub(r'', 'grnfre', subcount[44]) + regexs[45].sub(r'', 'grnfre', subcount[45]) + regexs[46].sub(r'', 'grnfre', subcount[46]) + regexs[47].sub(r'', 'grnfre', subcount[47]) + regexs[48].sub(r'', 'grnfre', subcount[48]) + regexs[16].search(r'znetva-gbc') + regexs[16].search(r'cbfvgvba') + regexs[19].search(r'gno1') + regexs[9].search(r'qz') + regexs[9].search(r'qg') + regexs[9].search(r'zbqobk') + regexs[9].search(r'zbqobkva') + regexs[9].search(r'zbqgvgyr') + regexs[13].search(r'uggc://cebsvyrrqvg.zlfcnpr.pbz/vaqrk.psz') + regexs[26].search(r'/vt/znvytnqtrg') + regexs[49].search(r'glcr') + + +def block5(): + for i in range(13): + regexs[14].sub(r'', 'purpx', subcount[14]) + regexs[15].sub(r'', 'purpx', subcount[15]) + regexs[14].sub(r'', 'pvgl', subcount[14]) + regexs[15].sub(r'', 'pvgl', subcount[15]) + regexs[14].sub(r'', 'qrpe fyvqrgrkg', subcount[14]) + regexs[15].sub(r'', 'qrpe fyvqrgrkg', subcount[15]) + regexs[14].sub(r'', 'svefg fryrpgrq', subcount[14]) + regexs[15].sub(r'', 'svefg fryrpgrq', subcount[15]) + regexs[14].sub(r'', 'uqy_rag', subcount[14]) + regexs[15].sub(r'', 'uqy_rag', subcount[15]) + regexs[14].sub(r'', 'vape fyvqrgrkg', subcount[14]) + regexs[15].sub(r'', 'vape fyvqrgrkg', subcount[15]) + regexs[5].sub(r'', 'vachggrkg QBZPbageby_cynprubyqre', subcount[5]) + regexs[14].sub( + r'', 'cnerag puebzr6 fvatyr1 gno fryrpgrq', subcount[14]) + regexs[15].sub( + r'', 'cnerag puebzr6 fvatyr1 gno fryrpgrq', subcount[15]) + regexs[14].sub(r'', 'cb_guz', subcount[14]) + regexs[15].sub(r'', 'cb_guz', subcount[15]) + regexs[14].sub(r'', 'fhozvg', subcount[14]) + regexs[15].sub(r'', 'fhozvg', subcount[15]) + regexs[50].search(r'') + re.search(r'NccyrJroXvg\/([^\s]*)', strings[0]) + re.search(r'XUGZY', strings[0]) + + for i in range(12): + re.sub(r'(\$\{cebg\})|(\$cebg\b)', '', + '${cebg}://${ubfg}${cngu}/${dz}', 0) + regexs[40].sub(r'', '1', subcount[40]) + regexs[10].sub(r'', '1', subcount[10]) + regexs[51].sub(r'', '1', subcount[51]) + regexs[52].sub(r'', '1', subcount[52]) + regexs[53].sub(r'', '1', subcount[53]) + regexs[39].sub(r'', '1', subcount[39]) + regexs[54].sub(r'', '1', subcount[54]) + re.sub(r'^(.*)\..*$', '', '9.0 e115', 1) + re.sub(r'^.*e(.*)$', '', '9.0 e115', 1) + regexs[55].sub(r'', '', subcount[55]) + regexs[55].sub( + r'', '', subcount[55]) + re.sub(r'^.*\s+(\S+\s+\S+$)', '', strings[1], 1) + regexs[30].sub(r'', 'tzk%2Subzrcntr%2Sfgneg%2Sqr%2S', subcount[30]) + regexs[30].sub(r'', 'tzk', subcount[30]) + re.sub(r'(\$\{ubfg\})|(\$ubfg\b)', '', + 'uggc://${ubfg}${cngu}/${dz}', 0) + regexs[56].sub( + r'', 'uggc://nqpyvrag.hvzfrei.arg${cngu}/${dz}', subcount[56]) + re.sub(r'(\$\{dz\})|(\$dz\b)', '', + 'uggc://nqpyvrag.hvzfrei.arg/wf.at/${dz}', 0) + regexs[29].sub(r'', 'frpgvba', subcount[29]) + regexs[30].sub(r'', 'frpgvba', subcount[30]) + regexs[29].sub(r'', 'fvgr', subcount[29]) + regexs[30].sub(r'', 'fvgr', subcount[30]) + regexs[29].sub(r'', 'fcrpvny', subcount[29]) + regexs[30].sub(r'', 'fcrpvny', subcount[30]) + regexs[36].search(r'anzr') + re.search(r'e', '9.0 e115') + + +def block6(): + for i in range(11): + re.sub(r'(?i)##yv0##', '', strings[27], 0) + regexs[57].sub(r'', strings[27], subcount[57]) + regexs[58].sub(r'', strings[28], subcount[58]) + regexs[59].sub(r'', strings[29], subcount[59]) + re.sub(r'(?i)##\/o##', '', strings[30], 0) + re.sub(r'(?i)##\/v##', '', strings[30], 0) + re.sub(r'(?i)##\/h##', '', strings[30], 0) + re.sub(r'(?i)##o##', '', strings[30], 0) + re.sub(r'(?i)##oe##', '', strings[30], 0) + re.sub(r'(?i)##v##', '', strings[30], 0) + re.sub(r'(?i)##h##', '', strings[30], 0) + re.sub(r'(?i)##n##', '', strings[31], 0) + re.sub(r'(?i)##\/n##', '', strings[32], 0) + + # This prints a unicode escape where the V8 version + # prints the unicode character. + re.sub(r'#~#argjbexybtb#~#', '', strings[33], 0) + + re.search(r' Zbovyr\/', strings[0]) + re.search(r'##yv1##', strings[27], re.IGNORECASE) + re.search(r'##yv10##', strings[28], re.IGNORECASE) + re.search(r'##yv11##', strings[28], re.IGNORECASE) + re.search(r'##yv12##', strings[28], re.IGNORECASE) + re.search(r'##yv13##', strings[28], re.IGNORECASE) + re.search(r'##yv14##', strings[28], re.IGNORECASE) + re.search(r'##yv15##', strings[28], re.IGNORECASE) + regexs[58].search(strings[28]) + re.search(r'##yv17##', strings[29], re.IGNORECASE) + re.search(r'##yv18##', strings[29], re.IGNORECASE) + regexs[59].search(strings[29]) + re.search(r'##yv2##', strings[27], re.IGNORECASE) + re.search(r'##yv20##', strings[30], re.IGNORECASE) + re.search(r'##yv21##', strings[30], re.IGNORECASE) + re.search(r'##yv22##', strings[30], re.IGNORECASE) + re.search(r'##yv23##', strings[30], re.IGNORECASE) + re.search(r'##yv3##', strings[27], re.IGNORECASE) + regexs[57].search(strings[27]) + re.search(r'##yv5##', strings[28], re.IGNORECASE) + re.search(r'##yv6##', strings[28], re.IGNORECASE) + re.search(r'##yv7##', strings[28], re.IGNORECASE) + re.search(r'##yv8##', strings[28], re.IGNORECASE) + re.search(r'##yv9##', strings[28], re.IGNORECASE) + regexs[8].search(r'473qq1rs0n2r70q9qo1pq48n021s9468ron90nps048p4p29') + regexs[8].search(r'SbeprqRkcvengvba=633669325184628362') + regexs[8].search( + r'FrffvbaQQS2=473qq1rs0n2r70q9qo1pq48n021s9468ron90nps048p4p29') + re.search(r'AbxvnA[^\/]*', strings[0]) + + for i in range(10): + re.sub(r'(?:^|\s+)bss(?:\s+|$)', '', ' bss', 0) + re.sub(r'(\$\{0\})|(\$0\b)', '', strings[34], 0) + re.sub(r'(\$\{1\})|(\$1\b)', '', strings[34], 0) + re.sub(r'(\$\{pbzcyrgr\})|(\$pbzcyrgr\b)', '', strings[34], 0) + re.sub(r'(\$\{sentzrag\})|(\$sentzrag\b)', '', strings[34], 0) + re.sub(r'(\$\{ubfgcbeg\})|(\$ubfgcbeg\b)', '', strings[34], 0) + regexs[56].sub(r'', strings[34], subcount[56]) + re.sub(r'(\$\{cebgbpby\})|(\$cebgbpby\b)', '', strings[34], 0) + re.sub(r'(\$\{dhrel\})|(\$dhrel\b)', '', strings[34], 0) + regexs[29].sub(r'', 'nqfvmr', subcount[29]) + regexs[30].sub(r'', 'nqfvmr', subcount[30]) + re.sub(r'(\$\{2\})|(\$2\b)', '', 'uggc://${2}${3}${4}${5}', 0) + re.sub(r'(\$\{3\})|(\$3\b)', '', + 'uggc://wf.hv-cbegny.qr${3}${4}${5}', 0) + regexs[40].sub(r'', 'arjf', subcount[40]) + regexs[41].sub(r'', 'arjf', subcount[41]) + regexs[42].sub(r'', 'arjf', subcount[42]) + regexs[43].sub(r'', 'arjf', subcount[43]) + regexs[44].sub(r'', 'arjf', subcount[44]) + regexs[45].sub(r'', 'arjf', subcount[45]) + regexs[46].sub(r'', 'arjf', subcount[46]) + regexs[47].sub(r'', 'arjf', subcount[47]) + regexs[48].sub(r'', 'arjf', subcount[48]) + re.search(r' PC=i=(\d+)&oe=(.)', strings[35]) + regexs[60].search(r' ') + regexs[60].search(r' bss') + regexs[60].search(r'') + regexs[19].search(r' ') + regexs[19].search(r'svefg ba') + regexs[19].search(r'ynfg vtaber') + regexs[19].search(r'ba') + regexs[9].search(r'scnq so ') + regexs[9].search(r'zrqvgobk') + regexs[9].search(r'hsgy') + regexs[9].search(r'lhv-h') + re.search(r'Fnsnev|Xbadhrebe|XUGZY', strings[0], re.IGNORECASE) + regexs[61].search( + r'uggc://wf.hv-cbegny.qr/tzk/ubzr/wf/20080602/onfr.wf') + regexs[62].search(r'#Ybtva_rznvy') + + +def block7(): + for i in range(9): + regexs[40].sub(r'', '0', subcount[40]) + regexs[10].sub(r'', '0', subcount[10]) + regexs[51].sub(r'', '0', subcount[51]) + regexs[52].sub(r'', '0', subcount[52]) + regexs[53].sub(r'', '0', subcount[53]) + regexs[39].sub(r'', '0', subcount[39]) + regexs[54].sub(r'', '0', subcount[54]) + regexs[40].sub(r'', 'Lrf', subcount[40]) + regexs[10].sub(r'', 'Lrf', subcount[10]) + regexs[51].sub(r'', 'Lrf', subcount[51]) + regexs[52].sub(r'', 'Lrf', subcount[52]) + regexs[53].sub(r'', 'Lrf', subcount[53]) + regexs[39].sub(r'', 'Lrf', subcount[39]) + regexs[54].sub(r'', 'Lrf', subcount[54]) + + for i in range(8): + regexs[63].sub(r'', 'Pybfr {0}', subcount[63]) + regexs[63].sub(r'', 'Bcra {0}', subcount[63]) + regexs[32].split(strings[36]) + regexs[32].split(strings[37]) + regexs[14].sub(r'', 'puvyq p1 svefg gnournqref', subcount[14]) + regexs[15].sub(r'', 'puvyq p1 svefg gnournqref', subcount[15]) + regexs[14].sub(r'', 'uqy_fcb', subcount[14]) + regexs[15].sub(r'', 'uqy_fcb', subcount[15]) + regexs[14].sub(r'', 'uvag', subcount[14]) + regexs[15].sub(r'', 'uvag', subcount[15]) + regexs[33].sub(r'', strings[38], subcount[33]) + regexs[14].sub(r'', 'yvfg', subcount[14]) + regexs[15].sub(r'', 'yvfg', subcount[15]) + regexs[30].sub(r'', 'at_bhgre', subcount[30]) + regexs[14].sub(r'', 'cnerag puebzr5 qbhoyr2 NU', subcount[14]) + regexs[15].sub(r'', 'cnerag puebzr5 qbhoyr2 NU', subcount[15]) + regexs[14].sub( + r'', 'cnerag puebzr5 dhnq5 ps NU osyvax zbarl', subcount[14]) + regexs[15].sub( + r'', 'cnerag puebzr5 dhnq5 ps NU osyvax zbarl', subcount[15]) + regexs[14].sub(r'', 'cnerag puebzr6 fvatyr1', subcount[14]) + regexs[15].sub(r'', 'cnerag puebzr6 fvatyr1', subcount[15]) + regexs[14].sub(r'', 'cb_qrs', subcount[14]) + regexs[15].sub(r'', 'cb_qrs', subcount[15]) + regexs[14].sub(r'', 'gnopbagrag', subcount[14]) + regexs[15].sub(r'', 'gnopbagrag', subcount[15]) + regexs[30].sub(r'', 'iv_svefg_gvzr', subcount[30]) + re.search(r'(^|.)(ronl|qri-ehf3.wbg)(|fgberf|zbgbef|yvirnhpgvbaf|jvxv|rkcerff|punggre).(pbz(|.nh|.pa|.ux|.zl|.ft|.oe|.zk)|pb(.hx|.xe|.am)|pn|qr|se|vg|ay|or|ng|pu|vr|va|rf|cy|cu|fr)$', 'cntrf.ronl.pbz', re.IGNORECASE) + regexs[8].search(r'144631658.0.10.1231364074') + regexs[8].search( + r'144631658.1231364074.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)') + regexs[8].search( + r'144631658.2294274870215848400.1231364074.1231364074.1231364074.1') + regexs[8].search(r'4413241q3660') + regexs[8].search(r'SbeprqRkcvengvba=633669357391353591') + regexs[8].search(strings[39]) + regexs[8].search(strings[40]) + regexs[8].search(r'AFP_zp_kkk-gdzogv_80=4413241q3660') + regexs[8].search( + r'FrffvbaQQS2=p98s8o9q42nr21or1r61pqorn1n002nsss569635984s6qp7') + regexs[8].search( + r'__hgzn=144631658.2294274870215848400.1231364074.1231364074.1231364074.1') + regexs[8].search(r'__hgzo=144631658.0.10.1231364074') + regexs[8].search( + r'__hgzm=144631658.1231364074.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)') + regexs[8].search(r'p98s8o9q42nr21or1r61pqorn1n002nsss569635984s6qp7') + regexs[34].search(strings[36]) + regexs[34].search(strings[37]) + + +def block8(): + for i in range(7): + re.match(r'\d+', strings[1]) + regexs[64].sub(r'', 'nsgre', subcount[64]) + regexs[64].sub(r'', 'orsber', subcount[64]) + regexs[64].sub(r'', 'obggbz', subcount[64]) + regexs[65].sub(r'', 'ohvygva_jrngure.kzy', subcount[65]) + regexs[37].sub(r'', 'ohggba', subcount[37]) + regexs[18].sub(r'', 'ohggba', subcount[18]) + regexs[65].sub(r'', 'qngrgvzr.kzy', subcount[65]) + regexs[65].sub( + r'', 'uggc://eff.paa.pbz/eff/paa_gbcfgbevrf.eff', subcount[65]) + regexs[37].sub(r'', 'vachg', subcount[37]) + regexs[18].sub(r'', 'vachg', subcount[18]) + regexs[64].sub(r'', 'vafvqr', subcount[64]) + regexs[27].sub(r'', 'cbvagre', subcount[27]) + re.sub(r'[A-Z]', '', 'cbfvgvba', 0) + regexs[27].sub(r'', 'gbc', subcount[27]) + regexs[64].sub(r'', 'gbc', subcount[64]) + regexs[37].sub(r'', 'hy', subcount[37]) + regexs[18].sub(r'', 'hy', subcount[18]) + regexs[37].sub(r'', strings[26], subcount[37]) + regexs[18].sub(r'', strings[26], subcount[18]) + regexs[65].sub(r'', 'lbhghor_vtbbtyr/i2/lbhghor.kzy', subcount[65]) + regexs[27].sub(r'', 'm-vaqrk', subcount[27]) + re.search(r'#([\w-]+)', strings[26]) + regexs[16].search(r'urvtug') + regexs[16].search(r'znetvaGbc') + regexs[16].search(r'jvqgu') + regexs[19].search(r'gno0 svefg ba') + regexs[19].search(r'gno0 ba') + regexs[19].search(r'gno4 ynfg') + regexs[19].search(r'gno4') + regexs[19].search(r'gno5') + regexs[19].search(r'gno6') + regexs[19].search(r'gno7') + regexs[19].search(r'gno8') + re.search(r'NqborNVE\/([^\s]*)', strings[0]) + re.search(r'NccyrJroXvg\/([^ ]*)', strings[0]) + re.search(r'XUGZY', strings[0], re.IGNORECASE) + re.search(r'^(?:obql|ugzy)$', 'YV', re.IGNORECASE) + regexs[38].search(r'ohggba') + regexs[38].search(r'vachg') + regexs[38].search(r'hy') + regexs[38].search(strings[26]) + re.search(r'^(\w+|\*)', strings[26]) + re.search(r'znp|jva|yvahk', 'Jva32', re.IGNORECASE) + re.search(r'eton?\([\d\s,]+\)', 'fgngvp') + + for i in range(6): + re.sub(r'\r', '', '', 0) + regexs[40].sub(r'', '/', subcount[40]) + regexs[10].sub(r'', '/', subcount[10]) + regexs[51].sub(r'', '/', subcount[51]) + regexs[52].sub(r'', '/', subcount[52]) + regexs[53].sub(r'', '/', subcount[53]) + regexs[39].sub(r'', '/', subcount[39]) + regexs[54].sub(r'', '/', subcount[54]) + regexs[63].sub( + r'', 'uggc://zfacbegny.112.2b7.arg/o/ff/zfacbegnyubzr/1/U.7-cqi-2/{0}?[NDO]&{1}&{2}&[NDR]', subcount[63]) + regexs[12].sub(r'', strings[41], subcount[12]) + regexs[23].sub(r'', 'uggc://jjj.snprobbx.pbz/fepu.cuc', subcount[23]) + regexs[40].sub(r'', 'freivpr', subcount[40]) + regexs[41].sub(r'', 'freivpr', subcount[41]) + regexs[42].sub(r'', 'freivpr', subcount[42]) + regexs[43].sub(r'', 'freivpr', subcount[43]) + regexs[44].sub(r'', 'freivpr', subcount[44]) + regexs[45].sub(r'', 'freivpr', subcount[45]) + regexs[46].sub(r'', 'freivpr', subcount[46]) + regexs[47].sub(r'', 'freivpr', subcount[47]) + regexs[48].sub(r'', 'freivpr', subcount[48]) + re.search(r'((ZFVR\s+([6-9]|\d\d)\.))', strings[0]) + regexs[66].search(r'') + regexs[50].search(r'fryrpgrq') + regexs[8].search(r'8sqq78r9n442851q565599o401385sp3s04r92rnn7o19ssn') + regexs[8].search(r'SbeprqRkcvengvba=633669340386893867') + regexs[8].search(r'VC=74.125.75.17') + regexs[8].search( + r'FrffvbaQQS2=8sqq78r9n442851q565599o401385sp3s04r92rnn7o19ssn') + re.search(r'Xbadhrebe|Fnsnev|XUGZY', strings[0]) + regexs[13].search(strings[41]) + regexs[49].search(r'unfsbphf') + + +def block9(): + for i in range(5): + regexs[32].split(strings[42]) + regexs[32].split(strings[43]) + regexs[20].split( + r'svz_zlfcnpr_hfre-ivrj-pbzzragf,svz_zlfcnpr_havgrq-fgngrf') + regexs[33].sub(r'', strings[44], subcount[33]) + regexs[67].sub( + r'', 'zrah_arj zrah_arj_gbttyr zrah_gbttyr', subcount[67]) + regexs[67].sub( + r'', 'zrah_byq zrah_byq_gbttyr zrah_gbttyr', subcount[67]) + regexs[8].search(r'102n9o0o9pq60132qn0337rr867p75953502q2s27s2s5r98') + regexs[8].search(r'144631658.0.10.1231364380') + regexs[8].search( + r'144631658.1231364380.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)') + regexs[8].search( + r'144631658.3931862196947939300.1231364380.1231364380.1231364380.1') + regexs[8].search(r'441326q33660') + regexs[8].search(r'SbeprqRkcvengvba=633669341278771470') + regexs[8].search(strings[45]) + regexs[8].search(strings[46]) + regexs[8].search(r'AFP_zp_dfctwzssrwh-aowb_80=441326q33660') + regexs[8].search( + r'FrffvbaQQS2=102n9o0o9pq60132qn0337rr867p75953502q2s27s2s5r98') + regexs[8].search( + r'__hgzn=144631658.3931862196947939300.1231364380.1231364380.1231364380.1') + regexs[8].search(r'__hgzo=144631658.0.10.1231364380') + regexs[8].search( + r'__hgzm=144631658.1231364380.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)') + + for i in range(4): + regexs[14].sub(r'', ' yvfg1', subcount[14]) + regexs[15].sub(r'', ' yvfg1', subcount[15]) + regexs[14].sub(r'', ' yvfg2', subcount[14]) + regexs[15].sub(r'', ' yvfg2', subcount[15]) + regexs[14].sub(r'', ' frneputebhc1', subcount[14]) + regexs[15].sub(r'', ' frneputebhc1', subcount[15]) + regexs[68].sub(r'', strings[47], subcount[68]) + regexs[18].sub(r'', strings[47], subcount[18]) + re.sub(r'&', '', '', 0) + regexs[35].sub(r'', '', subcount[35]) + regexs[63].sub(r'', '(..-{0})(|(d+)|)', subcount[63]) + regexs[18].sub(r'', strings[48], subcount[18]) + regexs[56].sub( + r'', '//vzt.jro.qr/vij/FC/${cngu}/${anzr}/${inyhr}?gf=${abj}', subcount[56]) + re.sub(r'(\$\{anzr\})|(\$anzr\b)', '', + '//vzt.jro.qr/vij/FC/tzk_uc/${anzr}/${inyhr}?gf=${abj}', 0) + regexs[69].sub( + r'', 'Jvaqbjf Yvir Ubgznvy{1}', subcount[69]) + regexs[63].sub( + r'', '{0}{1}', subcount[63]) + regexs[69].sub( + r'', '{1}', subcount[69]) + regexs[63].sub( + r'', '{1}', subcount[63]) + regexs[15].sub(r'', 'Vzntrf', subcount[15]) + regexs[15].sub(r'', 'ZFA', subcount[15]) + regexs[15].sub(r'', 'Zncf', subcount[15]) + regexs[39].sub(r'', 'Zbq-Vasb-Vasb-WninFpevcgUvag', subcount[39]) + regexs[15].sub(r'', 'Arjf', subcount[15]) + regexs[32].split(strings[49]) + regexs[32].split(strings[50]) + regexs[15].sub(r'', 'Ivqrb', subcount[15]) + regexs[15].sub(r'', 'Jro', subcount[15]) + regexs[39].sub(r'', 'n', subcount[39]) + regexs[70].split(r'nwnkFgneg') + regexs[70].split(r'nwnkFgbc') + regexs[14].sub(r'', 'ovaq', subcount[14]) + regexs[15].sub(r'', 'ovaq', subcount[15]) + regexs[63].sub( + r'', 'oevatf lbh zber. Zber fcnpr (5TO), zber frphevgl, fgvyy serr.', subcount[63]) + regexs[14].sub(r'', 'puvyq p1 svefg qrpx', subcount[14]) + regexs[15].sub(r'', 'puvyq p1 svefg qrpx', subcount[15]) + regexs[14].sub(r'', 'puvyq p1 svefg qbhoyr2', subcount[14]) + regexs[15].sub(r'', 'puvyq p1 svefg qbhoyr2', subcount[15]) + regexs[14].sub(r'', 'puvyq p2 ynfg', subcount[14]) + regexs[15].sub(r'', 'puvyq p2 ynfg', subcount[15]) + regexs[14].sub(r'', 'puvyq p2', subcount[14]) + regexs[15].sub(r'', 'puvyq p2', subcount[15]) + regexs[14].sub(r'', 'puvyq p3', subcount[14]) + regexs[15].sub(r'', 'puvyq p3', subcount[15]) + regexs[14].sub(r'', 'puvyq p4 ynfg', subcount[14]) + regexs[15].sub(r'', 'puvyq p4 ynfg', subcount[15]) + regexs[14].sub(r'', 'pbclevtug', subcount[14]) + regexs[15].sub(r'', 'pbclevtug', subcount[15]) + regexs[14].sub(r'', 'qZFAZR_1', subcount[14]) + regexs[15].sub(r'', 'qZFAZR_1', subcount[15]) + regexs[14].sub(r'', 'qbhoyr2 ps', subcount[14]) + regexs[15].sub(r'', 'qbhoyr2 ps', subcount[15]) + regexs[14].sub(r'', 'qbhoyr2', subcount[14]) + regexs[15].sub(r'', 'qbhoyr2', subcount[15]) + regexs[14].sub(r'', 'uqy_arj', subcount[14]) + regexs[15].sub(r'', 'uqy_arj', subcount[15]) + regexs[30].sub(r'', 'uc_fubccvatobk', subcount[30]) + regexs[29].sub(r'', 'ugzy%2Rvq', subcount[29]) + regexs[30].sub(r'', 'ugzy%2Rvq', subcount[30]) + regexs[33].sub(r'', strings[51], subcount[33]) + regexs[71].sub( + r'', 'uggc://wf.hv-cbegny.qr/tzk/ubzr/wf/20080602/cebgbglcr.wf${4}${5}', subcount[71]) + regexs[72].sub( + r'', 'uggc://wf.hv-cbegny.qr/tzk/ubzr/wf/20080602/cebgbglcr.wf${5}', subcount[72]) + regexs[73].sub(r'', strings[52], subcount[73]) + regexs[69].sub( + r'', 'uggc://zfacbegny.112.2b7.arg/o/ff/zfacbegnyubzr/1/U.7-cqi-2/f55332979829981?[NDO]&{1}&{2}&[NDR]', subcount[69]) + regexs[14].sub(r'', 'vztZFSG', subcount[14]) + regexs[15].sub(r'', 'vztZFSG', subcount[15]) + regexs[14].sub(r'', 'zfasbbg1 ps', subcount[14]) + regexs[15].sub(r'', 'zfasbbg1 ps', subcount[15]) + regexs[14].sub(r'', strings[53], subcount[14]) + regexs[15].sub(r'', strings[53], subcount[15]) + regexs[14].sub( + r'', 'cnerag puebzr6 fvatyr1 gno fryrpgrq ovaq', subcount[14]) + regexs[15].sub( + r'', 'cnerag puebzr6 fvatyr1 gno fryrpgrq ovaq', subcount[15]) + regexs[14].sub(r'', 'cevznel', subcount[14]) + regexs[15].sub(r'', 'cevznel', subcount[15]) + regexs[30].sub(r'', 'erpgnatyr', subcount[30]) + regexs[14].sub(r'', 'frpbaqnel', subcount[14]) + regexs[15].sub(r'', 'frpbaqnel', subcount[15]) + regexs[70].split(r'haybnq') + regexs[63].sub(r'', '{0}{1}1', subcount[63]) + regexs[69].sub(r'', '|{1}1', subcount[69]) + re.search(r'(..-HF)(\|(\d+)|)', 'xb-xe,ra-va,gu-gu', re.IGNORECASE) + regexs[4].search(r'/ZlFcnprNccf/NccPnainf,45000012') + regexs[8].search(r'144631658.0.10.1231367708') + regexs[8].search( + r'144631658.1231367708.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)') + regexs[8].search( + r'144631658.2770915348920628700.1231367708.1231367708.1231367708.1') + regexs[8].search(r'4413235p3660') + regexs[8].search(r'441327q73660') + regexs[8].search(r'9995p6rp12rrnr893334ro7nq70o7p64p69rqn844prs1473') + regexs[8].search(r'SbeprqRkcvengvba=633669350559478880') + regexs[8].search(strings[54]) + regexs[8].search(strings[55]) + regexs[8].search(r'AFP_zp_dfctwzs-aowb_80=441327q73660') + regexs[8].search(r'AFP_zp_kkk-aowb_80=4413235p3660') + regexs[8].search( + r'FrffvbaQQS2=9995p6rp12rrnr893334ro7nq70o7p64p69rqn844prs1473') + regexs[8].search( + r'__hgzn=144631658.2770915348920628700.1231367708.1231367708.1231367708.1') + regexs[8].search(r'__hgzo=144631658.0.10.1231367708') + regexs[8].search( + r'__hgzm=144631658.1231367708.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)') + regexs[34].search(strings[49]) + regexs[34].search(strings[50]) + re.search(r'ZFVR\s+5[.]01', strings[0]) + re.search(r'HF(?=;)', strings[56], re.IGNORECASE) + regexs[74].search(strings[47]) + regexs[28].search(r'svefg npgvir svefgNpgvir') + regexs[28].search(r'ynfg') + re.search( + r'\bp:(..)', 'm:94043|yn:37.4154|yb:-122.0585|p:HF', re.IGNORECASE) + regexs[75].search(strings[57]) + regexs[75].search(strings[58]) + regexs[76].search(strings[57]) + regexs[76].search(strings[58]) + regexs[77].search(strings[57]) + regexs[77].search(strings[58]) + re.search(r'\bhfucce\s*=\s*([^;]*)', strings[59], re.IGNORECASE) + regexs[78].search(strings[57]) + regexs[78].search(strings[58]) + re.search(r'\bjci\s*=\s*([^;]*)', strings[59], re.IGNORECASE) + regexs[79].search(strings[58]) + regexs[79].search(strings[60]) + regexs[79].search(strings[59]) + re.search( + r'\|p:([a-z]{2})', 'm:94043|yn:37.4154|yb:-122.0585|p:HF|ue:1', re.IGNORECASE) + regexs[80].search(strings[47]) + regexs[61].search(r'cebgbglcr.wf') + regexs[68].search(strings[47]) + regexs[81].search(strings[47]) + regexs[82].search(strings[47]) + re.search(r'^Fubpxjnir Synfu (\d)', strings[1]) + re.search(r'^Fubpxjnir Synfu (\d+)', strings[1]) + regexs[83].search(r'[bowrpg tybony]') + regexs[62].search(strings[47]) + regexs[84].search(strings[61]) + regexs[84].search(strings[62]) + re.search(r'jroxvg', strings[63]) + + +def block10(): + for i in range(3): + regexs[39].sub(r'', '%3Szxg=ra-HF', subcount[39]) + regexs[40].sub(r'', '-8', subcount[40]) + regexs[10].sub(r'', '-8', subcount[10]) + regexs[51].sub(r'', '-8', subcount[51]) + regexs[52].sub(r'', '-8', subcount[52]) + regexs[53].sub(r'', '-8', subcount[53]) + regexs[39].sub(r'', '-8', subcount[39]) + regexs[54].sub(r'', '-8', subcount[54]) + regexs[40].sub(r'', '1.5', subcount[40]) + regexs[10].sub(r'', '1.5', subcount[10]) + regexs[51].sub(r'', '1.5', subcount[51]) + regexs[52].sub(r'', '1.5', subcount[52]) + regexs[53].sub(r'', '1.5', subcount[53]) + regexs[39].sub(r'', '1.5', subcount[39]) + regexs[54].sub(r'', '1.5', subcount[54]) + regexs[40].sub(r'', '1024k768', subcount[40]) + regexs[10].sub(r'', '1024k768', subcount[10]) + regexs[51].sub(r'', '1024k768', subcount[51]) + regexs[52].sub(r'', '1024k768', subcount[52]) + regexs[53].sub(r'', '1024k768', subcount[53]) + regexs[39].sub(r'', '1024k768', subcount[39]) + regexs[54].sub(r'', '1024k768', subcount[54]) + regexs[40].sub(r'', strings[64], subcount[40]) + regexs[10].sub(r'', strings[64], subcount[10]) + regexs[51].sub(r'', strings[64], subcount[51]) + regexs[52].sub(r'', strings[64], subcount[52]) + regexs[53].sub(r'', strings[64], subcount[53]) + regexs[39].sub(r'', strings[64], subcount[39]) + regexs[54].sub(r'', strings[64], subcount[54]) + regexs[40].sub(r'', '14', subcount[40]) + regexs[10].sub(r'', '14', subcount[10]) + regexs[51].sub(r'', '14', subcount[51]) + regexs[52].sub(r'', '14', subcount[52]) + regexs[53].sub(r'', '14', subcount[53]) + regexs[39].sub(r'', '14', subcount[39]) + regexs[54].sub(r'', '14', subcount[54]) + regexs[40].sub(r'', '24', subcount[40]) + regexs[10].sub(r'', '24', subcount[10]) + regexs[51].sub(r'', '24', subcount[51]) + regexs[52].sub(r'', '24', subcount[52]) + regexs[53].sub(r'', '24', subcount[53]) + regexs[39].sub(r'', '24', subcount[39]) + regexs[54].sub(r'', '24', subcount[54]) + regexs[40].sub(r'', strings[65], subcount[40]) + regexs[10].sub(r'', strings[65], subcount[10]) + regexs[51].sub(r'', strings[65], subcount[51]) + regexs[52].sub(r'', strings[65], subcount[52]) + regexs[53].sub(r'', strings[65], subcount[53]) + regexs[39].sub(r'', strings[65], subcount[39]) + regexs[54].sub(r'', strings[65], subcount[54]) + regexs[40].sub(r'', strings[66], subcount[40]) + regexs[10].sub(r'', strings[66], subcount[10]) + regexs[51].sub(r'', strings[66], subcount[51]) + regexs[52].sub(r'', strings[66], subcount[52]) + regexs[53].sub(r'', strings[66], subcount[53]) + regexs[39].sub(r'', strings[66], subcount[39]) + regexs[54].sub(r'', strings[66], subcount[54]) + regexs[40].sub(r'', '9.0', subcount[40]) + regexs[10].sub(r'', '9.0', subcount[10]) + regexs[51].sub(r'', '9.0', subcount[51]) + regexs[52].sub(r'', '9.0', subcount[52]) + regexs[53].sub(r'', '9.0', subcount[53]) + regexs[39].sub(r'', '9.0', subcount[39]) + regexs[54].sub(r'', '9.0', subcount[54]) + regexs[40].sub(r'', '994k634', subcount[40]) + regexs[10].sub(r'', '994k634', subcount[10]) + regexs[51].sub(r'', '994k634', subcount[51]) + regexs[52].sub(r'', '994k634', subcount[52]) + regexs[53].sub(r'', '994k634', subcount[53]) + regexs[39].sub(r'', '994k634', subcount[39]) + regexs[54].sub(r'', '994k634', subcount[54]) + regexs[40].sub(r'', '?zxg=ra-HF', subcount[40]) + regexs[10].sub(r'', '?zxg=ra-HF', subcount[10]) + regexs[51].sub(r'', '?zxg=ra-HF', subcount[51]) + regexs[52].sub(r'', '?zxg=ra-HF', subcount[52]) + regexs[53].sub(r'', '?zxg=ra-HF', subcount[53]) + regexs[54].sub(r'', '?zxg=ra-HF', subcount[54]) + regexs[25].sub(r'', 'PAA.pbz', subcount[25]) + regexs[12].sub(r'', 'PAA.pbz', subcount[12]) + regexs[39].sub(r'', 'PAA.pbz', subcount[39]) + regexs[25].sub(r'', 'Qngr & Gvzr', subcount[25]) + regexs[12].sub(r'', 'Qngr & Gvzr', subcount[12]) + regexs[39].sub(r'', 'Qngr & Gvzr', subcount[39]) + regexs[40].sub(r'', 'Frnepu Zvpebfbsg.pbz', subcount[40]) + regexs[54].sub(r'', 'Frnepu Zvpebfbsg.pbz', subcount[54]) + regexs[10].sub(r'', strings[67], subcount[10]) + regexs[51].sub(r'', strings[67], subcount[51]) + regexs[52].sub(r'', strings[67], subcount[52]) + regexs[53].sub(r'', strings[67], subcount[53]) + regexs[39].sub(r'', strings[67], subcount[39]) + regexs[32].split(strings[68]) + regexs[32].split(strings[69]) + regexs[52].sub(r'', strings[70], subcount[52]) + regexs[53].sub(r'', strings[70], subcount[53]) + regexs[39].sub(r'', strings[70], subcount[39]) + regexs[40].sub(r'', strings[71], subcount[40]) + regexs[10].sub(r'', strings[71], subcount[10]) + regexs[51].sub(r'', strings[71], subcount[51]) + regexs[54].sub(r'', strings[71], subcount[54]) + regexs[25].sub(r'', 'Jrngure', subcount[25]) + regexs[12].sub(r'', 'Jrngure', subcount[12]) + regexs[39].sub(r'', 'Jrngure', subcount[39]) + regexs[25].sub(r'', 'LbhGhor', subcount[25]) + regexs[12].sub(r'', 'LbhGhor', subcount[12]) + regexs[39].sub(r'', 'LbhGhor', subcount[39]) + regexs[33].sub(r'', strings[72], subcount[33]) + re.sub(r'^erzbgr_vsenzr_', '', 'erzbgr_vsenzr_1', 1) + regexs[40].sub(r'', strings[73], subcount[40]) + regexs[10].sub(r'', strings[73], subcount[10]) + regexs[51].sub(r'', strings[73], subcount[51]) + regexs[52].sub(r'', strings[73], subcount[52]) + regexs[53].sub(r'', strings[73], subcount[53]) + regexs[39].sub(r'', strings[73], subcount[39]) + regexs[54].sub(r'', strings[73], subcount[54]) + regexs[40].sub(r'', strings[74], subcount[40]) + regexs[10].sub(r'', strings[74], subcount[10]) + regexs[51].sub(r'', strings[74], subcount[51]) + regexs[52].sub(r'', strings[74], subcount[52]) + regexs[53].sub(r'', strings[74], subcount[53]) + regexs[39].sub(r'', strings[74], subcount[39]) + regexs[54].sub(r'', strings[74], subcount[54]) + re.sub(r'\-', '', 'lhv-h', 0) + regexs[9].search(r'p') + regexs[9].search(r'qz p') + regexs[9].search(r'zbqynory') + regexs[9].search(r'lhv-h svefg') + regexs[8].search(r'144631658.0.10.1231365779') + regexs[8].search( + r'144631658.1231365779.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)') + regexs[8].search( + r'144631658.1877536177953918500.1231365779.1231365779.1231365779.1') + regexs[8].search(strings[75]) + regexs[8].search(strings[76]) + regexs[8].search( + r'__hgzn=144631658.1877536177953918500.1231365779.1231365779.1231365779.1') + regexs[8].search(r'__hgzo=144631658.0.10.1231365779') + regexs[8].search( + r'__hgzm=144631658.1231365779.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)') + regexs[34].search(strings[68]) + regexs[34].search(strings[69]) + re.search(r'^$', '') + regexs[31].search(r'qr') + re.search(r'^znk\d+$', '') + re.search(r'^zva\d+$', '') + re.search(r'^erfgber$', '') + regexs[85].search(r'zbqobkva zbqobk_abcnqqvat ') + regexs[85].search(r'zbqgvgyr') + regexs[85].search(r'eaq_zbqobkva ') + regexs[85].search(r'eaq_zbqgvgyr ') + re.search(r'frpgvba\d+_pbagragf', 'obggbz_ani') + + +def block11(): + for i in range(2): + regexs[18].sub(r'', ' .pybfr', subcount[18]) + regexs[18].sub(r'', ' n.svryqOgaPnapry', subcount[18]) + regexs[18].sub(r'', ' qg', subcount[18]) + regexs[68].sub(r'', strings[77], subcount[68]) + regexs[18].sub(r'', strings[77], subcount[18]) + regexs[39].sub(r'', '', subcount[39]) + re.sub(r'^', '', '', 1) + regexs[86].split(r'') + regexs[39].sub(r'', '*', subcount[39]) + regexs[68].sub(r'', '*', subcount[68]) + regexs[18].sub(r'', '*', subcount[18]) + regexs[68].sub(r'', '.pybfr', subcount[68]) + regexs[18].sub(r'', '.pybfr', subcount[18]) + regexs[87].sub( + r'', '//vzt.jro.qr/vij/FC/tzk_uc/fperra/${inyhr}?gf=${abj}', subcount[87]) + regexs[88].sub( + r'', '//vzt.jro.qr/vij/FC/tzk_uc/fperra/1024?gf=${abj}', subcount[88]) + regexs[87].sub( + r'', '//vzt.jro.qr/vij/FC/tzk_uc/jvafvmr/${inyhr}?gf=${abj}', subcount[87]) + regexs[88].sub( + r'', '//vzt.jro.qr/vij/FC/tzk_uc/jvafvmr/992/608?gf=${abj}', subcount[88]) + regexs[30].sub(r'', '300k120', subcount[30]) + regexs[30].sub(r'', '300k250', subcount[30]) + regexs[30].sub(r'', '310k120', subcount[30]) + regexs[30].sub(r'', '310k170', subcount[30]) + regexs[30].sub(r'', '310k250', subcount[30]) + re.sub(r'^.*\.(.*)\s.*$', '', '9.0 e115', 1) + regexs[2].sub(r'', 'Nppbeqvba', subcount[2]) + regexs[89].sub(r'', 'Nxghryy\x0a', subcount[89]) + regexs[90].sub(r'', 'Nxghryy\x0a', subcount[90]) + regexs[2].sub(r'', 'Nccyvpngvba', subcount[2]) + regexs[89].sub(r'', 'Oyvpxchaxg\x0a', subcount[89]) + regexs[90].sub(r'', 'Oyvpxchaxg\x0a', subcount[90]) + regexs[89].sub(r'', 'Svanamra\x0a', subcount[89]) + regexs[90].sub(r'', 'Svanamra\x0a', subcount[90]) + regexs[89].sub(r'', 'Tnzrf\x0a', subcount[89]) + regexs[90].sub(r'', 'Tnzrf\x0a', subcount[90]) + regexs[89].sub(r'', 'Ubebfxbc\x0a', subcount[89]) + regexs[90].sub(r'', 'Ubebfxbc\x0a', subcount[90]) + regexs[89].sub(r'', 'Xvab\x0a', subcount[89]) + regexs[90].sub(r'', 'Xvab\x0a', subcount[90]) + regexs[2].sub(r'', 'Zbqhyrf', subcount[2]) + regexs[89].sub(r'', 'Zhfvx\x0a', subcount[89]) + regexs[90].sub(r'', 'Zhfvx\x0a', subcount[90]) + regexs[89].sub(r'', 'Anpuevpugra\x0a', subcount[89]) + regexs[90].sub(r'', 'Anpuevpugra\x0a', subcount[90]) + regexs[2].sub(r'', 'Cuk', subcount[2]) + regexs[70].split(r'ErdhrfgSvavfu') + regexs[70].split(r'ErdhrfgSvavfu.NWNK.Cuk') + regexs[89].sub(r'', 'Ebhgr\x0a', subcount[89]) + regexs[90].sub(r'', 'Ebhgr\x0a', subcount[90]) + regexs[32].split(strings[78]) + regexs[32].split(strings[79]) + regexs[32].split(strings[80]) + regexs[32].split(strings[81]) + regexs[89].sub(r'', 'Fcbeg\x0a', subcount[89]) + regexs[90].sub(r'', 'Fcbeg\x0a', subcount[90]) + regexs[89].sub(r'', 'GI-Fcbg\x0a', subcount[89]) + regexs[90].sub(r'', 'GI-Fcbg\x0a', subcount[90]) + regexs[89].sub(r'', 'Gbhe\x0a', subcount[89]) + regexs[90].sub(r'', 'Gbhe\x0a', subcount[90]) + regexs[89].sub(r'', 'Hagreunyghat\x0a', subcount[89]) + regexs[90].sub(r'', 'Hagreunyghat\x0a', subcount[90]) + regexs[89].sub(r'', 'Ivqrb\x0a', subcount[89]) + regexs[90].sub(r'', 'Ivqrb\x0a', subcount[90]) + regexs[89].sub(r'', 'Jrggre\x0a', subcount[89]) + regexs[90].sub(r'', 'Jrggre\x0a', subcount[90]) + regexs[68].sub(r'', strings[82], subcount[68]) + regexs[18].sub(r'', strings[82], subcount[18]) + regexs[68].sub(r'', strings[83], subcount[68]) + regexs[18].sub(r'', strings[83], subcount[18]) + regexs[68].sub(r'', strings[84], subcount[68]) + regexs[18].sub(r'', strings[84], subcount[18]) + regexs[30].sub(r'', 'nqiFreivprObk', subcount[30]) + regexs[30].sub(r'', 'nqiFubccvatObk', subcount[30]) + regexs[39].sub(r'', 'nwnk', subcount[39]) + regexs[40].sub(r'', 'nxghryy', subcount[40]) + regexs[41].sub(r'', 'nxghryy', subcount[41]) + regexs[42].sub(r'', 'nxghryy', subcount[42]) + regexs[43].sub(r'', 'nxghryy', subcount[43]) + regexs[44].sub(r'', 'nxghryy', subcount[44]) + regexs[45].sub(r'', 'nxghryy', subcount[45]) + regexs[46].sub(r'', 'nxghryy', subcount[46]) + regexs[47].sub(r'', 'nxghryy', subcount[47]) + regexs[48].sub(r'', 'nxghryy', subcount[48]) + regexs[40].sub(r'', strings[85], subcount[40]) + regexs[41].sub(r'', strings[85], subcount[41]) + regexs[42].sub(r'', strings[85], subcount[42]) + regexs[43].sub(r'', strings[85], subcount[43]) + regexs[44].sub(r'', strings[85], subcount[44]) + regexs[45].sub(r'', strings[85], subcount[45]) + regexs[46].sub(r'', strings[85], subcount[46]) + regexs[47].sub(r'', strings[85], subcount[47]) + regexs[48].sub(r'', strings[85], subcount[48]) + regexs[29].sub(r'', 'pngrtbel', subcount[29]) + regexs[30].sub(r'', 'pngrtbel', subcount[30]) + regexs[39].sub(r'', 'pybfr', subcount[39]) + regexs[39].sub(r'', 'qvi', subcount[39]) + regexs[68].sub(r'', strings[86], subcount[68]) + regexs[18].sub(r'', strings[86], subcount[18]) + regexs[39].sub(r'', 'qg', subcount[39]) + regexs[68].sub(r'', 'qg', subcount[68]) + regexs[18].sub(r'', 'qg', subcount[18]) + regexs[39].sub(r'', 'rzorq', subcount[39]) + regexs[68].sub(r'', 'rzorq', subcount[68]) + regexs[18].sub(r'', 'rzorq', subcount[18]) + regexs[39].sub(r'', 'svryqOga', subcount[39]) + regexs[39].sub(r'', 'svryqOgaPnapry', subcount[39]) + regexs[20].split(r'svz_zlfcnpr_nccf-pnainf,svz_zlfcnpr_havgrq-fgngrf') + regexs[40].sub(r'', 'svanamra', subcount[40]) + regexs[41].sub(r'', 'svanamra', subcount[41]) + regexs[42].sub(r'', 'svanamra', subcount[42]) + regexs[43].sub(r'', 'svanamra', subcount[43]) + regexs[44].sub(r'', 'svanamra', subcount[44]) + regexs[45].sub(r'', 'svanamra', subcount[45]) + regexs[46].sub(r'', 'svanamra', subcount[46]) + regexs[47].sub(r'', 'svanamra', subcount[47]) + regexs[48].sub(r'', 'svanamra', subcount[48]) + regexs[70].split(r'sbphf') + regexs[70].split(r'sbphf.gno sbphfva.gno') + regexs[70].split(r'sbphfva') + regexs[39].sub(r'', 'sbez', subcount[39]) + regexs[68].sub(r'', 'sbez.nwnk', subcount[68]) + regexs[18].sub(r'', 'sbez.nwnk', subcount[18]) + regexs[40].sub(r'', 'tnzrf', subcount[40]) + regexs[41].sub(r'', 'tnzrf', subcount[41]) + regexs[42].sub(r'', 'tnzrf', subcount[42]) + regexs[43].sub(r'', 'tnzrf', subcount[43]) + regexs[44].sub(r'', 'tnzrf', subcount[44]) + regexs[45].sub(r'', 'tnzrf', subcount[45]) + regexs[46].sub(r'', 'tnzrf', subcount[46]) + regexs[47].sub(r'', 'tnzrf', subcount[47]) + regexs[48].sub(r'', 'tnzrf', subcount[48]) + regexs[30].sub(r'', 'ubzrcntr', subcount[30]) + regexs[40].sub(r'', 'ubebfxbc', subcount[40]) + regexs[41].sub(r'', 'ubebfxbc', subcount[41]) + regexs[42].sub(r'', 'ubebfxbc', subcount[42]) + regexs[43].sub(r'', 'ubebfxbc', subcount[43]) + regexs[44].sub(r'', 'ubebfxbc', subcount[44]) + regexs[45].sub(r'', 'ubebfxbc', subcount[45]) + regexs[46].sub(r'', 'ubebfxbc', subcount[46]) + regexs[47].sub(r'', 'ubebfxbc', subcount[47]) + regexs[48].sub(r'', 'ubebfxbc', subcount[48]) + regexs[30].sub(r'', 'uc_cebzbobk_ugzy%2Puc_cebzbobk_vzt', subcount[30]) + regexs[30].sub(r'', 'uc_erpgnatyr', subcount[30]) + regexs[33].sub(r'', strings[87], subcount[33]) + regexs[33].sub(r'', strings[88], subcount[33]) + regexs[71].sub( + r'', 'uggc://wf.hv-cbegny.qr/tzk/ubzr/wf/20080602/onfr.wf${4}${5}', subcount[71]) + regexs[72].sub( + r'', 'uggc://wf.hv-cbegny.qr/tzk/ubzr/wf/20080602/onfr.wf${5}', subcount[72]) + regexs[71].sub( + r'', 'uggc://wf.hv-cbegny.qr/tzk/ubzr/wf/20080602/qlaYvo.wf${4}${5}', subcount[71]) + regexs[72].sub( + r'', 'uggc://wf.hv-cbegny.qr/tzk/ubzr/wf/20080602/qlaYvo.wf${5}', subcount[72]) + regexs[71].sub( + r'', 'uggc://wf.hv-cbegny.qr/tzk/ubzr/wf/20080602/rssrpgYvo.wf${4}${5}', subcount[71]) + regexs[72].sub( + r'', 'uggc://wf.hv-cbegny.qr/tzk/ubzr/wf/20080602/rssrpgYvo.wf${5}', subcount[72]) + regexs[73].sub(r'', strings[89], subcount[73]) + regexs[69].sub( + r'', 'uggc://zfacbegny.112.2b7.arg/o/ff/zfacbegnyubzr/1/U.7-cqi-2/f55023338617756?[NDO]&{1}&{2}&[NDR]', subcount[69]) + regexs[23].sub(r'', strings[6], subcount[23]) + regexs[40].sub(r'', 'xvab', subcount[40]) + regexs[41].sub(r'', 'xvab', subcount[41]) + regexs[42].sub(r'', 'xvab', subcount[42]) + regexs[43].sub(r'', 'xvab', subcount[43]) + regexs[44].sub(r'', 'xvab', subcount[44]) + regexs[45].sub(r'', 'xvab', subcount[45]) + regexs[46].sub(r'', 'xvab', subcount[46]) + regexs[47].sub(r'', 'xvab', subcount[47]) + regexs[48].sub(r'', 'xvab', subcount[48]) + regexs[70].split(r'ybnq') + regexs[18].sub( + r'', 'zrqvnzbqgno lhv-anifrg lhv-anifrg-gbc', subcount[18]) + regexs[39].sub(r'', 'zrgn', subcount[39]) + regexs[68].sub(r'', strings[90], subcount[68]) + regexs[18].sub(r'', strings[90], subcount[18]) + regexs[70].split(r'zbhfrzbir') + regexs[70].split(r'zbhfrzbir.gno') + re.sub(r'^.*jroxvg\/(\d+(\.\d+)?).*$', '', strings[63], 1) + regexs[40].sub(r'', 'zhfvx', subcount[40]) + regexs[41].sub(r'', 'zhfvx', subcount[41]) + regexs[42].sub(r'', 'zhfvx', subcount[42]) + regexs[43].sub(r'', 'zhfvx', subcount[43]) + regexs[44].sub(r'', 'zhfvx', subcount[44]) + regexs[45].sub(r'', 'zhfvx', subcount[45]) + regexs[46].sub(r'', 'zhfvx', subcount[46]) + regexs[47].sub(r'', 'zhfvx', subcount[47]) + regexs[48].sub(r'', 'zhfvx', subcount[48]) + regexs[52].sub(r'', 'zlfcnpr_nccf_pnainf', subcount[52]) + regexs[40].sub(r'', strings[91], subcount[40]) + regexs[41].sub(r'', strings[91], subcount[41]) + regexs[42].sub(r'', strings[91], subcount[42]) + regexs[43].sub(r'', strings[91], subcount[43]) + regexs[44].sub(r'', strings[91], subcount[44]) + regexs[45].sub(r'', strings[91], subcount[45]) + regexs[46].sub(r'', strings[91], subcount[46]) + regexs[47].sub(r'', strings[91], subcount[47]) + regexs[48].sub(r'', strings[91], subcount[48]) + regexs[39].sub(r'', 'anzr', subcount[39]) + + # This prints something different to the V8 version + # The V8 version is escaping different things in the string that + # has the substitutions performed on it. + # + # V8 treats /\S/ like / + escaped S + / + # Python treats it like / + \ + S + / + re.sub(r'\b\w+\b', '', strings[92], 0) + + regexs[39].sub(r'', 'bow-nppbeqvba', subcount[39]) + regexs[39].sub(r'', 'bowrpg', subcount[39]) + regexs[68].sub(r'', 'bowrpg', subcount[68]) + regexs[18].sub(r'', 'bowrpg', subcount[18]) + regexs[29].sub(r'', 'cnenzf%2Rfglyrf', subcount[29]) + regexs[30].sub(r'', 'cnenzf%2Rfglyrf', subcount[30]) + regexs[30].sub(r'', 'cbchc', subcount[30]) + regexs[40].sub(r'', 'ebhgr', subcount[40]) + regexs[41].sub(r'', 'ebhgr', subcount[41]) + regexs[42].sub(r'', 'ebhgr', subcount[42]) + regexs[43].sub(r'', 'ebhgr', subcount[43]) + regexs[44].sub(r'', 'ebhgr', subcount[44]) + regexs[45].sub(r'', 'ebhgr', subcount[45]) + regexs[46].sub(r'', 'ebhgr', subcount[46]) + regexs[47].sub(r'', 'ebhgr', subcount[47]) + regexs[48].sub(r'', 'ebhgr', subcount[48]) + regexs[30].sub(r'', 'freivprobk_uc', subcount[30]) + regexs[30].sub(r'', 'fubccvatobk_uc', subcount[30]) + regexs[39].sub(r'', 'fubhgobk', subcount[39]) + regexs[40].sub(r'', 'fcbeg', subcount[40]) + regexs[41].sub(r'', 'fcbeg', subcount[41]) + regexs[42].sub(r'', 'fcbeg', subcount[42]) + regexs[43].sub(r'', 'fcbeg', subcount[43]) + regexs[44].sub(r'', 'fcbeg', subcount[44]) + regexs[45].sub(r'', 'fcbeg', subcount[45]) + regexs[46].sub(r'', 'fcbeg', subcount[46]) + regexs[47].sub(r'', 'fcbeg', subcount[47]) + regexs[48].sub(r'', 'fcbeg', subcount[48]) + regexs[40].sub(r'', 'gbhe', subcount[40]) + regexs[41].sub(r'', 'gbhe', subcount[41]) + regexs[42].sub(r'', 'gbhe', subcount[42]) + regexs[43].sub(r'', 'gbhe', subcount[43]) + regexs[44].sub(r'', 'gbhe', subcount[44]) + regexs[45].sub(r'', 'gbhe', subcount[45]) + regexs[46].sub(r'', 'gbhe', subcount[46]) + regexs[47].sub(r'', 'gbhe', subcount[47]) + regexs[48].sub(r'', 'gbhe', subcount[48]) + regexs[40].sub(r'', 'gi-fcbg', subcount[40]) + regexs[41].sub(r'', 'gi-fcbg', subcount[41]) + regexs[42].sub(r'', 'gi-fcbg', subcount[42]) + regexs[43].sub(r'', 'gi-fcbg', subcount[43]) + regexs[44].sub(r'', 'gi-fcbg', subcount[44]) + regexs[45].sub(r'', 'gi-fcbg', subcount[45]) + regexs[46].sub(r'', 'gi-fcbg', subcount[46]) + regexs[47].sub(r'', 'gi-fcbg', subcount[47]) + regexs[48].sub(r'', 'gi-fcbg', subcount[48]) + regexs[39].sub(r'', 'glcr', subcount[39]) + re.sub(r'\/', '', 'haqrsvarq', 0) + regexs[40].sub(r'', strings[93], subcount[40]) + regexs[41].sub(r'', strings[93], subcount[41]) + regexs[42].sub(r'', strings[93], subcount[42]) + regexs[43].sub(r'', strings[93], subcount[43]) + regexs[44].sub(r'', strings[93], subcount[44]) + regexs[45].sub(r'', strings[93], subcount[45]) + regexs[46].sub(r'', strings[93], subcount[46]) + regexs[47].sub(r'', strings[93], subcount[47]) + regexs[48].sub(r'', strings[93], subcount[48]) + regexs[40].sub(r'', 'ivqrb', subcount[40]) + regexs[41].sub(r'', 'ivqrb', subcount[41]) + regexs[42].sub(r'', 'ivqrb', subcount[42]) + regexs[43].sub(r'', 'ivqrb', subcount[43]) + regexs[44].sub(r'', 'ivqrb', subcount[44]) + regexs[45].sub(r'', 'ivqrb', subcount[45]) + regexs[46].sub(r'', 'ivqrb', subcount[46]) + regexs[47].sub(r'', 'ivqrb', subcount[47]) + regexs[48].sub(r'', 'ivqrb', subcount[48]) + regexs[86].split(r'ivfvgf=1') + regexs[40].sub(r'', 'jrggre', subcount[40]) + regexs[41].sub(r'', 'jrggre', subcount[41]) + regexs[42].sub(r'', 'jrggre', subcount[42]) + regexs[43].sub(r'', 'jrggre', subcount[43]) + regexs[44].sub(r'', 'jrggre', subcount[44]) + regexs[45].sub(r'', 'jrggre', subcount[45]) + regexs[46].sub(r'', 'jrggre', subcount[46]) + regexs[47].sub(r'', 'jrggre', subcount[47]) + regexs[48].sub(r'', 'jrggre', subcount[48]) + re.search(r'#[a-z0-9]+$', + 'uggc://jjj.fpuhryreim.arg/Qrsnhyg', re.IGNORECASE) + regexs[66].search(r'fryrpgrq') + re.search(r'(?:^|\s+)lhv-ani(?:\s+|$)', 'sff lhv-ani') + re.search(r'(?:^|\s+)lhv-anifrg(?:\s+|$)', 'zrqvnzbqgno lhv-anifrg') + re.search(r'(?:^|\s+)lhv-anifrg-gbc(?:\s+|$)', + 'zrqvnzbqgno lhv-anifrg') + regexs[91].search(r'GnoThvq') + regexs[91].search(r'thvq') + re.search(r'(pbzcngvoyr|jroxvg)', strings[63]) + re.search(r'.+(?:ei|vg|en|vr)[\/: ]([\d.]+)', strings[63]) + regexs[8].search(r'144631658.0.10.1231365869') + regexs[8].search(r'144631658.0.10.1231367054') + regexs[8].search( + r'144631658.1231365869.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)') + regexs[8].search( + r'144631658.1231367054.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)') + regexs[8].search( + r'144631658.1670816052019209000.1231365869.1231365869.1231365869.1') + regexs[8].search( + r'144631658.1796080716621419500.1231367054.1231367054.1231367054.1') + regexs[8].search(strings[94]) + regexs[8].search(strings[95]) + regexs[8].search(strings[96]) + regexs[8].search(strings[97]) + regexs[8].search( + r'__hgzn=144631658.1670816052019209000.1231365869.1231365869.1231365869.1') + regexs[8].search( + r'__hgzn=144631658.1796080716621419500.1231367054.1231367054.1231367054.1') + regexs[8].search(r'__hgzo=144631658.0.10.1231365869') + regexs[8].search(r'__hgzo=144631658.0.10.1231367054') + regexs[8].search( + r'__hgzm=144631658.1231365869.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)') + regexs[8].search( + r'__hgzm=144631658.1231367054.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)') + regexs[34].search(strings[78]) + regexs[34].search(strings[79]) + regexs[34].search(strings[81]) + regexs[74].search(strings[77]) + regexs[74].search(r'*') + regexs[74].search(strings[82]) + regexs[74].search(strings[83]) + regexs[74].search(strings[86]) + regexs[74].search(r'rzorq') + regexs[74].search(r'sbez.nwnk') + regexs[74].search(strings[90]) + regexs[74].search(r'bowrpg') + re.search(r'\/onfr.wf(\?.+)?$', + '/uggc://wf.hv-cbegny.qr/tzk/ubzr/wf/20080602/onfr.wf') + regexs[28].search(r'uvag ynfgUvag ynfg') + regexs[75].search(r'') + regexs[76].search(r'') + regexs[77].search(r'') + regexs[78].search(r'') + regexs[80].search(strings[77]) + regexs[80].search(r'*') + regexs[80].search(r'.pybfr') + regexs[80].search(strings[82]) + regexs[80].search(strings[83]) + regexs[80].search(strings[84]) + regexs[80].search(strings[86]) + regexs[80].search(r'qg') + regexs[80].search(r'rzorq') + regexs[80].search(r'sbez.nwnk') + regexs[80].search(strings[90]) + regexs[80].search(r'bowrpg') + regexs[61].search(r'qlaYvo.wf') + regexs[61].search(r'rssrpgYvo.wf') + regexs[61].search(r'uggc://jjj.tzk.arg/qr/?fgnghf=uvajrvf') + regexs[92].search(r' .pybfr') + regexs[92].search(r' n.svryqOgaPnapry') + regexs[92].search(r' qg') + regexs[92].search(strings[48]) + regexs[92].search(r'.nwnk') + regexs[92].search(r'.svryqOga,n.svryqOgaPnapry') + regexs[92].search(r'.svryqOgaPnapry') + regexs[92].search(r'.bow-nppbeqvba qg') + regexs[68].search(strings[77]) + regexs[68].search(r'*') + regexs[68].search(r'.pybfr') + regexs[68].search(strings[82]) + regexs[68].search(strings[83]) + regexs[68].search(strings[84]) + regexs[68].search(strings[86]) + regexs[68].search(r'qg') + regexs[68].search(r'rzorq') + regexs[68].search(r'sbez.nwnk') + regexs[68].search(strings[90]) + regexs[68].search(r'bowrpg') + regexs[93].search(r' .pybfr') + regexs[93].search(r' n.svryqOgaPnapry') + regexs[93].search(r' qg') + regexs[93].search(strings[48]) + regexs[93].search(r'.nwnk') + regexs[93].search(r'.svryqOga,n.svryqOgaPnapry') + regexs[93].search(r'.svryqOgaPnapry') + regexs[93].search(r'.bow-nppbeqvba qg') + regexs[81].search(strings[77]) + regexs[81].search(r'*') + regexs[81].search(strings[48]) + regexs[81].search(r'.pybfr') + regexs[81].search(strings[82]) + regexs[81].search(strings[83]) + regexs[81].search(strings[84]) + regexs[81].search(strings[86]) + regexs[81].search(r'qg') + regexs[81].search(r'rzorq') + regexs[81].search(r'sbez.nwnk') + regexs[81].search(strings[90]) + regexs[81].search(r'bowrpg') + regexs[94].search(r' .pybfr') + regexs[94].search(r' n.svryqOgaPnapry') + regexs[94].search(r' qg') + regexs[94].search(strings[48]) + regexs[94].search(r'.nwnk') + regexs[94].search(r'.svryqOga,n.svryqOgaPnapry') + regexs[94].search(r'.svryqOgaPnapry') + regexs[94].search(r'.bow-nppbeqvba qg') + regexs[94].search(r'[anzr=nwnkHey]') + regexs[94].search(strings[82]) + regexs[31].search(r'rf') + regexs[31].search(r'wn') + regexs[82].search(strings[77]) + regexs[82].search(r'*') + regexs[82].search(strings[48]) + regexs[82].search(r'.pybfr') + regexs[82].search(strings[82]) + regexs[82].search(strings[83]) + regexs[82].search(strings[84]) + regexs[82].search(strings[86]) + regexs[82].search(r'qg') + regexs[82].search(r'rzorq') + regexs[82].search(r'sbez.nwnk') + regexs[82].search(strings[90]) + regexs[82].search(r'bowrpg') + regexs[83].search(strings[98]) + regexs[83].search(r'shapgvba sbphf() { [angvir pbqr] }') + regexs[62].search(r'#Ybtva') + regexs[62].search(r'#Ybtva_cnffjbeq') + regexs[62].search(strings[77]) + regexs[62].search(r'#fubhgobkWf') + regexs[62].search(r'#fubhgobkWfReebe') + regexs[62].search(r'#fubhgobkWfFhpprff') + regexs[62].search(r'*') + regexs[62].search(strings[82]) + regexs[62].search(strings[83]) + regexs[62].search(strings[86]) + regexs[62].search(r'rzorq') + regexs[62].search(r'sbez.nwnk') + regexs[62].search(strings[90]) + regexs[62].search(r'bowrpg') + regexs[49].search(r'pbagrag') + regexs[24].search(strings[6]) + re.search(r'xbadhrebe', strings[63]) + re.search(r'znp', 'jva32') + re.search(r'zbmvyyn', strings[63]) + re.search(r'zfvr', strings[63]) + re.search(r'ag\s5\.1', strings[63]) + re.search(r'bcren', strings[63]) + re.search(r'fnsnev', strings[63]) + re.search(r'jva', 'jva32') + re.search(r'jvaqbjf', strings[63]) + + +def bench_regex_v8(loops): + for loops in range(loops): + block0() + block1() + block2() + block3() + block4() + block5() + block6() + block7() + block8() + block9() + block10() + block11() + + +def run(): + bench_regex_v8(8) + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/scimark.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/scimark.py new file mode 100644 index 0000000000..44a129d1fd --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/scimark.py @@ -0,0 +1,414 @@ +from array import array +import math +import argparse + + +class Array2D(object): + + def __init__(self, w, h, data=None): + self.width = w + self.height = h + self.data = array('d', [0]) * (w * h) + if data is not None: + self.setup(data) + + def _idx(self, x, y): + if 0 <= x < self.width and 0 <= y < self.height: + return y * self.width + x + raise IndexError + + def __getitem__(self, x_y): + (x, y) = x_y + return self.data[self._idx(x, y)] + + def __setitem__(self, x_y, val): + (x, y) = x_y + self.data[self._idx(x, y)] = val + + def setup(self, data): + for y in range(self.height): + for x in range(self.width): + self[x, y] = data[y][x] + return self + + def indexes(self): + for y in range(self.height): + for x in range(self.width): + yield x, y + + def copy_data_from(self, other): + self.data[:] = other.data[:] + + +class Random(object): + MDIG = 32 + ONE = 1 + m1 = (ONE << (MDIG - 2)) + ((ONE << (MDIG - 2)) - ONE) + m2 = ONE << MDIG // 2 + dm1 = 1.0 / float(m1) + + def __init__(self, seed): + self.initialize(seed) + self.left = 0.0 + self.right = 1.0 + self.width = 1.0 + self.haveRange = False + + def initialize(self, seed): + + self.seed = seed + seed = abs(seed) + jseed = min(seed, self.m1) + if (jseed % 2 == 0): + jseed -= 1 + k0 = 9069 % self.m2 + k1 = 9069 / self.m2 + j0 = jseed % self.m2 + j1 = jseed / self.m2 + self.m = array('d', [0]) * 17 + for iloop in range(17): + jseed = j0 * k0 + j1 = (jseed / self.m2 + j0 * k1 + j1 * k0) % (self.m2 / 2) + j0 = jseed % self.m2 + self.m[iloop] = j0 + self.m2 * j1 + self.i = 4 + self.j = 16 + + def nextDouble(self): + I, J, m = self.i, self.j, self.m + k = m[I] - m[J] + if (k < 0): + k += self.m1 + self.m[J] = k + + if (I == 0): + I = 16 + else: + I -= 1 + self.i = I + + if (J == 0): + J = 16 + else: + J -= 1 + self.j = J + + if (self.haveRange): + return self.left + self.dm1 * float(k) * self.width + else: + return self.dm1 * float(k) + + def RandomMatrix(self, a): + for x, y in a.indexes(): + a[x, y] = self.nextDouble() + return a + + def RandomVector(self, n): + return array('d', [self.nextDouble() for i in range(n)]) + + +def copy_vector(vec): + # Copy a vector created by Random.RandomVector() + vec2 = array('d') + vec2[:] = vec[:] + return vec2 + + +class ArrayList(Array2D): + + def __init__(self, w, h, data=None): + self.width = w + self.height = h + self.data = [array('d', [0]) * w for y in range(h)] + if data is not None: + self.setup(data) + + def __getitem__(self, idx): + if isinstance(idx, tuple): + return self.data[idx[1]][idx[0]] + else: + return self.data[idx] + + def __setitem__(self, idx, val): + if isinstance(idx, tuple): + self.data[idx[1]][idx[0]] = val + else: + self.data[idx] = val + + def copy_data_from(self, other): + for l1, l2 in zip(self.data, other.data): + l1[:] = l2 + + +def SOR_execute(omega, G, cycles, Array): + for p in range(cycles): + for y in range(1, G.height - 1): + for x in range(1, G.width - 1): + G[x, y] = (omega * 0.25 * (G[x, y - 1] + G[x, y + 1] + G[x - 1, y] + + G[x + 1, y]) + + (1.0 - omega) * G[x, y]) + + +def bench_SOR(loops, n, cycles, Array): + range_it = range(loops) + + for _ in range_it: + G = Array(n, n) + SOR_execute(1.25, G, cycles, Array) + + +def SparseCompRow_matmult(M, y, val, row, col, x, num_iterations): + range_it = range(num_iterations) + + for _ in range_it: + for r in range(M): + sa = 0.0 + for i in range(row[r], row[r + 1]): + sa += x[col[i]] * val[i] + y[r] = sa + + +def bench_SparseMatMult(cycles, N, nz): + x = array('d', [0]) * N + y = array('d', [0]) * N + + nr = nz // N + anz = nr * N + val = array('d', [0]) * anz + col = array('i', [0]) * nz + row = array('i', [0]) * (N + 1) + + row[0] = 0 + for r in range(N): + rowr = row[r] + step = r // nr + row[r + 1] = rowr + nr + if step < 1: + step = 1 + for i in range(nr): + col[rowr + i] = i * step + + return SparseCompRow_matmult(N, y, val, row, col, x, cycles) + + +def MonteCarlo(Num_samples): + rnd = Random(113) + under_curve = 0 + for count in range(Num_samples): + x = rnd.nextDouble() + y = rnd.nextDouble() + if x * x + y * y <= 1.0: + under_curve += 1 + return float(under_curve) / Num_samples * 4.0 + + +def bench_MonteCarlo(loops, Num_samples): + range_it = range(loops) + + for _ in range_it: + MonteCarlo(Num_samples) + + +def LU_factor(A, pivot): + M, N = A.height, A.width + minMN = min(M, N) + for j in range(minMN): + jp = j + t = abs(A[j][j]) + for i in range(j + 1, M): + ab = abs(A[i][j]) + if ab > t: + jp = i + t = ab + pivot[j] = jp + + if A[jp][j] == 0: + raise Exception("factorization failed because of zero pivot") + + if jp != j: + A[j], A[jp] = A[jp], A[j] + + if j < M - 1: + recp = 1.0 / A[j][j] + for k in range(j + 1, M): + A[k][j] *= recp + + if j < minMN - 1: + for ii in range(j + 1, M): + for jj in range(j + 1, N): + A[ii][jj] -= A[ii][j] * A[j][jj] + + +def LU(lu, A, pivot): + lu.copy_data_from(A) + LU_factor(lu, pivot) + + +def bench_LU(cycles, N): + rnd = Random(7) + A = rnd.RandomMatrix(ArrayList(N, N)) + lu = ArrayList(N, N) + pivot = array('i', [0]) * N + range_it = range(cycles) + + for _ in range_it: + LU(lu, A, pivot) + + +def int_log2(n): + k = 1 + log = 0 + while k < n: + k *= 2 + log += 1 + if n != 1 << log: + raise Exception("FFT: Data length is not a power of 2: %s" % n) + return log + + +def FFT_num_flops(N): + return (5.0 * N - 2) * int_log2(N) + 2 * (N + 1) + + +def FFT_transform_internal(N, data, direction): + n = N // 2 + bit = 0 + dual = 1 + if n == 1: + return + + logn = int_log2(n) + if N == 0: + return + FFT_bitreverse(N, data) + + # apply fft recursion + # this loop executed int_log2(N) times + bit = 0 + while bit < logn: + w_real = 1.0 + w_imag = 0.0 + theta = 2.0 * direction * math.pi / (2.0 * float(dual)) + s = math.sin(theta) + t = math.sin(theta / 2.0) + s2 = 2.0 * t * t + for b in range(0, n, 2 * dual): + i = 2 * b + j = 2 * (b + dual) + wd_real = data[j] + wd_imag = data[j + 1] + data[j] = data[i] - wd_real + data[j + 1] = data[i + 1] - wd_imag + data[i] += wd_real + data[i + 1] += wd_imag + for a in range(1, dual): + tmp_real = w_real - s * w_imag - s2 * w_real + tmp_imag = w_imag + s * w_real - s2 * w_imag + w_real = tmp_real + w_imag = tmp_imag + for b in range(0, n, 2 * dual): + i = 2 * (b + a) + j = 2 * (b + a + dual) + z1_real = data[j] + z1_imag = data[j + 1] + wd_real = w_real * z1_real - w_imag * z1_imag + wd_imag = w_real * z1_imag + w_imag * z1_real + data[j] = data[i] - wd_real + data[j + 1] = data[i + 1] - wd_imag + data[i] += wd_real + data[i + 1] += wd_imag + bit += 1 + dual *= 2 + + +def FFT_bitreverse(N, data): + n = N // 2 + nm1 = n - 1 + j = 0 + for i in range(nm1): + ii = i << 1 + jj = j << 1 + k = n >> 1 + if i < j: + tmp_real = data[ii] + tmp_imag = data[ii + 1] + data[ii] = data[jj] + data[ii + 1] = data[jj + 1] + data[jj] = tmp_real + data[jj + 1] = tmp_imag + while k <= j: + j -= k + k >>= 1 + j += k + + +def FFT_transform(N, data): + FFT_transform_internal(N, data, -1) + + +def FFT_inverse(N, data): + n = N / 2 + norm = 0.0 + FFT_transform_internal(N, data, +1) + norm = 1 / float(n) + for i in range(N): + data[i] *= norm + + +def bench_FFT(loops, N, cycles): + twoN = 2 * N + init_vec = Random(7).RandomVector(twoN) + range_it = range(loops) + + for _ in range_it: + x = copy_vector(init_vec) + for i in range(cycles): + FFT_transform(twoN, x) + FFT_inverse(twoN, x) + + +def add_cmdline_args(cmd, args): + if args.benchmark: + cmd.append(args.benchmark) + + +BENCHMARKS = { + # function name => arguments + 'sor': (bench_SOR, 1, 100, 1, Array2D), + 'sparse_mat_mult': (bench_SparseMatMult, 4, 1000, 50 * 1000), + 'monte_carlo': (bench_MonteCarlo, 2, 10 * 1000,), + 'lu': (bench_LU, 1, 50,), + 'fft': (bench_FFT, 1, 1024, 5), +} + + +def run(): + parser = argparse.ArgumentParser(prog="python") + parser.add_argument("benchmark", nargs='?', + choices=sorted(BENCHMARKS)) + + args = parser.parse_args() + if args.benchmark: + benchmarks = (args.benchmark,) + else: + benchmarks = sorted(BENCHMARKS) + + for bench in benchmarks: + func, *func_args = BENCHMARKS[bench] + func(*func_args) + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/spectral_norm.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/spectral_norm.py new file mode 100644 index 0000000000..63cad9f280 --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/spectral_norm.py @@ -0,0 +1,81 @@ +""" +MathWorld: "Hundred-Dollar, Hundred-Digit Challenge Problems", Challenge #3. +http://mathworld.wolfram.com/Hundred-DollarHundred-DigitChallengeProblems.html + +The Computer Language Benchmarks Game +http://benchmarksgame.alioth.debian.org/u64q/spectralnorm-description.html#spectralnorm + +Contributed by Sebastien Loisel +Fixed by Isaac Gouy +Sped up by Josh Goldfoot +Dirtily sped up by Simon Descarpentries +Concurrency by Jason Stitt +""" + + +DEFAULT_N = 130 + + +def eval_A(i, j): + return 1.0 / ((i + j) * (i + j + 1) // 2 + i + 1) + + +def eval_times_u(func, u): + return [func((i, u)) for i in range(len(list(u)))] + + +def eval_AtA_times_u(u): + return eval_times_u(part_At_times_u, eval_times_u(part_A_times_u, u)) + + +def part_A_times_u(i_u): + i, u = i_u + partial_sum = 0 + for j, u_j in enumerate(u): + partial_sum += eval_A(i, j) * u_j + return partial_sum + + +def part_At_times_u(i_u): + i, u = i_u + partial_sum = 0 + for j, u_j in enumerate(u): + partial_sum += eval_A(j, i) * u_j + return partial_sum + + +def bench_spectral_norm(loops): + range_it = range(loops) + + for _ in range_it: + u = [1] * DEFAULT_N + + for dummy in range(10): + v = eval_AtA_times_u(u) + u = eval_AtA_times_u(v) + + vBv = vv = 0 + + for ue, ve in zip(u, v): + vBv += ue * ve + vv += ve * ve + + +def run(): + bench_spectral_norm(1) + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/telco.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/telco.py new file mode 100644 index 0000000000..fefc0a81ae --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/telco.py @@ -0,0 +1,101 @@ +# coding: UTF-8 +""" Telco Benchmark for measuring the performance of decimal calculations + +- http://speleotrove.com/decimal/telco.html +- http://speleotrove.com/decimal/telcoSpec.html + +A call type indicator, c, is set from the bottom (least significant) bit of the duration (hence c is 0 or 1). +A rate, r, is determined from the call type. Those calls with c=0 have a low r: 0.0013; the remainder (‘distance calls’) have a ‘premium’ r: 0.00894. (The rates are, very roughly, in Euros or dollarates per second.) +A price, p, for the call is then calculated (p=r*n). This is rounded to exactly 2 fractional digits using round-half-even (Banker’s round to nearest). +A basic tax, b, is calculated: b=p*0.0675 (6.75%). This is truncated to exactly 2 fractional digits (round-down), and the total basic tax variable is then incremented (sumB=sumB+b). +For distance calls: a distance tax, d, is calculated: d=p*0.0341 (3.41%). This is truncated to exactly 2 fractional digits (round-down), and then the total distance tax variable is incremented (sumD=sumD+d). +The total price, t, is calculated (t=p+b, and, if a distance call, t=t+d). +The total prices variable is incremented (sumT=sumT+t). +The total price, t, is converted to a string, s. + +""" + +from decimal import ROUND_HALF_EVEN, ROUND_DOWN, Decimal, getcontext, Context +import io +import os +from struct import unpack + + +def rel_path(*path): + return os.path.join(os.path.dirname(__file__), *path) + + +def bench_telco(loops, filename): + getcontext().rounding = ROUND_DOWN + rates = list(map(Decimal, ('0.0013', '0.00894'))) + twodig = Decimal('0.01') + Banker = Context(rounding=ROUND_HALF_EVEN) + basictax = Decimal("0.0675") + disttax = Decimal("0.0341") + + with open(filename, "rb") as infil: + data = infil.read() + + infil = io.BytesIO(data) + outfil = io.StringIO() + + for _ in range(loops): + infil.seek(0) + + sumT = Decimal("0") # sum of total prices + sumB = Decimal("0") # sum of basic tax + sumD = Decimal("0") # sum of 'distance' tax + + for i in range(5000): + datum = infil.read(8) + if datum == '': + break + n, = unpack('>Q', datum) + + calltype = n & 1 + r = rates[calltype] + + p = Banker.quantize(r * n, twodig) + + b = p * basictax + b = b.quantize(twodig) + sumB += b + + t = p + b + + if calltype: + d = p * disttax + d = d.quantize(twodig) + sumD += d + t += d + + sumT += t + print(t, file=outfil) + + outfil.seek(0) + outfil.truncate() + + +def run(): + filename = rel_path("data", "telco-bench.b") + bench_telco(1, filename) + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } + + +def dependencies(): + return ["data/telco-bench.b"] diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/unpack_sequence.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/unpack_sequence.py new file mode 100644 index 0000000000..eae9d95223 --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/unpack_sequence.py @@ -0,0 +1,466 @@ +"""Microbenchmark for Python's sequence unpacking.""" + +import argparse + + +def do_unpacking(loops, to_unpack): + range_it = range(loops) + + for _ in range_it: + # 400 unpackings + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + a, b, c, d, e, f, g, h, i, j = to_unpack + + +def bench_tuple_unpacking(loops): + x = tuple(range(10)) + do_unpacking(loops, x) + + +def bench_list_unpacking(loops): + x = list(range(10)) + + do_unpacking(loops, x) + + +def bench_all(loops): + bench_tuple_unpacking(loops) + bench_list_unpacking(loops) + + +def add_cmdline_args(cmd, args): + if args.benchmark: + cmd.append(args.benchmark) + + +def run(): + benchmarks = {"tuple": bench_tuple_unpacking, + "list": bench_list_unpacking} + + parser = argparse.ArgumentParser(prog="python") + parser.add_argument("benchmark", nargs="?", + choices=sorted(benchmarks)) + + options = parser.parse_args() + name = 'unpack_sequence' + if options.benchmark: + func = benchmarks[options.benchmark] + name += "_%s" % options.benchmark + else: + func = bench_all + + func(8192) + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/unpickle.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/unpickle.py new file mode 100644 index 0000000000..18bc21a969 --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/unpickle.py @@ -0,0 +1,28 @@ +import sys +import os +# Add benchmark directory to path to allow import of bm_pickle.py +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) +import bm_pickle + +def run(): + bm_pickle.__benchmark__(["unpickle"]) + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } + + +def dependencies(): + return ["bm_pickle.py"] diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/unpickle_list.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/unpickle_list.py new file mode 100644 index 0000000000..c155a5282c --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/unpickle_list.py @@ -0,0 +1,28 @@ +import sys +import os +# Add benchmark directory to path to allow import of bm_pickle.py +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) +import bm_pickle + +def run(): + bm_pickle.__benchmark__(["unpickle_list"]) + + +def warmupIterations(): + return 0 + + +def iterations(): + return 10 + + +def summary(): + return { + "name": "OutlierRemovalAverageSummary", + "lower-threshold": 0.0, + "upper-threshold": 1.0, + } + + +def dependencies(): + return ["bm_pickle.py"] diff --git a/mx.graalpython/mx_graalpython.py b/mx.graalpython/mx_graalpython.py index 95df723378..77e9a184f2 100644 --- a/mx.graalpython/mx_graalpython.py +++ b/mx.graalpython/mx_graalpython.py @@ -2087,6 +2087,9 @@ def python_checkcopyrights(args): "/hpy/", "com.oracle.graal.python.test.integration/src/org.graalvm.python.vfs/", "com.oracle.graal.python.test.integration/src/GRAALPY-VFS/", + "com.oracle.graal.python.benchmarks/python/micro/pyperformance/", + "com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.py", + "com.oracle.graal.python.benchmarks/python/micro/numpy/common.py", ]): pass elif os.path.splitext(line)[1] in [".py", ".java", ".c", ".h", ".sh"]: diff --git a/mx.graalpython/mx_graalpython_benchmark.py b/mx.graalpython/mx_graalpython_benchmark.py index f0e8089e91..9c1b412c8f 100644 --- a/mx.graalpython/mx_graalpython_benchmark.py +++ b/mx.graalpython/mx_graalpython_benchmark.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018, 2025, Oracle and/or its affiliates. +# Copyright (c) 2018, 2026, Oracle and/or its affiliates. # Copyright (c) 2013, Regents of the University of California # # All rights reserved. @@ -1145,10 +1145,10 @@ def graalpython_polybench_runner(polybench_run: mx_polybench.PolybenchRunFunctio mx_polybench.register_polybench_benchmark_suite(mx_suite=SUITE, name="python", languages=["python"], benchmark_distribution="GRAALPYTHON_POLYBENCH_BENCHMARKS", - # Match all python files, except for: - # * harness.py - # * tests/__init__.py - # These two are necessary for running the C-extension-module benchmarks, - # but are not benchmarks themselves. - benchmark_file_filter=r"^(?!.*(harness\.py|tests/__init__\.py)$).*\.py$", + # There are python files that are necessary for running some benchmarks, + # but are not benchmarks themselves. For this reason, we exclude them: + # * harness.py (C-extension-module) + # * tests/__init__.py (C-extension-module) + # * interpreter/bench_core.py (numpy) + benchmark_file_filter=r"^(?!.*(harness\.py|tests/__init__\.py|interpreter/bench_core\.py)$).*\.py$", runner=graalpython_polybench_runner, tags={"gate", "benchmark", "instructions"}) diff --git a/mx.graalpython/polybench-stable-run-config.json b/mx.graalpython/polybench-stable-run-config.json index 4b8f5e856b..3341e29995 100644 --- a/mx.graalpython/polybench-stable-run-config.json +++ b/mx.graalpython/polybench-stable-run-config.json @@ -301,5 +301,430 @@ "policy": "outlier-elimination-all-builds", "forks": "3x3", "focus": "0.0-0.3" + }, + "interpreter/bm_pathlib.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "interpreter/bm_pickle.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "interpreter/bm_richards.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "interpreter/chaos.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "interpreter/fannkuch.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "interpreter/float.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "interpreter/go.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "interpreter/hexiom.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "interpreter/json_dumps.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "interpreter/json_loads.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "interpreter/meteor_contest.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "interpreter/nbody.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "interpreter/nqueens.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "interpreter/pickle_dict.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "interpreter/pickle_list.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "interpreter/pickle_pure_python.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "interpreter/pidigits.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "interpreter/pyflate.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "interpreter/regex_compile.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "interpreter/regex_dna.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "interpreter/regex_effbot.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "interpreter/regex_v8.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "interpreter/scimark.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "interpreter/spectral_norm.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "interpreter/telco.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "interpreter/unpack_sequence.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "interpreter/unpickle_list.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "interpreter/unpickle.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "numpy/bench_core.Core.time_array_1.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "numpy/bench_core.Core.time_array_empty.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "numpy/bench_core.Core.time_arange_100.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "numpy/bench_core.Core.time_array_float64_l1000.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "numpy/bench_core.Core.time_array_float_l1000.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "numpy/bench_core.Core.time_array_float_l1000_dtype.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "numpy/bench_core.Core.time_array_int_l1000.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "numpy/bench_core.Core.time_array_l.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "numpy/bench_core.Core.time_array_l1.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "numpy/bench_core.Core.time_array_l100.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "numpy/bench_core.Core.time_array_l_view.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "numpy/bench_core.Core.time_can_cast.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "numpy/bench_core.Core.time_can_cast_same_kind.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "numpy/bench_core.Core.time_diag_l100.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "numpy/bench_core.Core.time_diagflat_l100.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "numpy/bench_core.Core.time_diagflat_l50_l50.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "numpy/bench_core.Core.time_dstack_l.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "numpy/bench_core.Core.time_empty_100.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "numpy/bench_core.Core.time_empty_like.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "numpy/bench_core.Core.time_eye_100.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "numpy/bench_core.Core.time_eye_3000.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "numpy/bench_core.Core.time_hstack_l.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "numpy/bench_core.Core.time_identity_100.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "numpy/bench_core.Core.time_identity_3000.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "numpy/bench_core.Core.time_ones_100.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "numpy/bench_core.Core.time_tril_indices_500.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "numpy/bench_core.Core.time_tril_l10x10.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "numpy/bench_core.Core.time_triu_indices_500.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "numpy/bench_core.Core.time_triu_l10x10.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "numpy/bench_core.Core.time_vstack_l.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "numpy/bench_core.Core.time_zeros_100.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "numpy/bench_core.CorrConv.time_convolve.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "numpy/bench_core.CorrConv.time_correlate.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "numpy/bench_core.CountNonzero.time_count_nonzero.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "numpy/bench_core.CountNonzero.time_count_nonzero_axis.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "numpy/bench_core.CountNonzero.time_count_nonzero_multi_axis.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "numpy/bench_core.Indices.time_indices.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "numpy/bench_core.PackBits.time_packbits.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "numpy/bench_core.PackBits.time_packbits_axis0.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "numpy/bench_core.PackBits.time_packbits_axis1.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "numpy/bench_core.PackBits.time_packbits_little.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "numpy/bench_core.StatsMethods.time_max.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "numpy/bench_core.StatsMethods.time_mean.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "numpy/bench_core.StatsMethods.time_min.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "numpy/bench_core.StatsMethods.time_prod.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "numpy/bench_core.StatsMethods.time_std.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "numpy/bench_core.StatsMethods.time_sum.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "numpy/bench_core.StatsMethods.time_var.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "numpy/bench_core.Temporaries.time_large.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "numpy/bench_core.Temporaries.time_large2.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "numpy/bench_core.Temporaries.time_mid.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "numpy/bench_core.Temporaries.time_mid2.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "numpy/bench_core.UnpackBits.time_unpackbits.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "numpy/bench_core.UnpackBits.time_unpackbits_axis0.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "numpy/bench_core.UnpackBits.time_unpackbits_axis1.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "numpy/bench_core.UnpackBits.time_unpackbits_axis1_little.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" + }, + "numpy/bench_core.UnpackBits.time_unpackbits_little.py": { + "policy": "outlier-elimination-all-builds", + "forks": "1x1", + "focus": "0.0-1.0" } } diff --git a/mx.graalpython/suite.py b/mx.graalpython/suite.py index 4969452b67..69af31b25b 100644 --- a/mx.graalpython/suite.py +++ b/mx.graalpython/suite.py @@ -1538,6 +1538,94 @@ "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/c-magic-bool.py", "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/c-magic-iter.py", "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/c-member-access.py", + # Batch 4 (pyperformance) + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/bm_pathlib.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/bm_pickle.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/bm_richards.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/chaos.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/fannkuch.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/float.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/go.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/hexiom.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/json_dumps.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/json_loads.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/meteor_contest.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/nbody.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/nqueens.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/pickle_dict.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/pickle_list.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/pidigits.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/pyflate.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/regex_compile.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/regex_dna.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/regex_effbot.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/regex_v8.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/scimark.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/spectral_norm.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/telco.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/unpack_sequence.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/unpickle_list.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/unpickle.py", + ], + "./numpy/": [ + # Batch 5 (numpy) + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_array_1.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_array_empty.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_arange_100.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_array_float64_l1000.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_array_float_l1000.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_array_float_l1000_dtype.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_array_int_l1000.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_array_l.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_array_l1.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_array_l100.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_array_l_view.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_can_cast.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_can_cast_same_kind.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_diag_l100.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_diagflat_l100.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_diagflat_l50_l50.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_dstack_l.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_empty_100.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_empty_like.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_eye_100.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_eye_3000.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_hstack_l.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_identity_100.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_identity_3000.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_ones_100.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_tril_indices_500.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_tril_l10x10.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_triu_indices_500.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_triu_l10x10.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_vstack_l.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Core.time_zeros_100.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.CorrConv.time_convolve.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.CorrConv.time_correlate.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.CountNonzero.time_count_nonzero.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.CountNonzero.time_count_nonzero_axis.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.CountNonzero.time_count_nonzero_multi_axis.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Indices.time_indices.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.PackBits.time_packbits.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.PackBits.time_packbits_axis0.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.PackBits.time_packbits_axis1.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.PackBits.time_packbits_little.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.StatsMethods.time_max.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.StatsMethods.time_mean.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.StatsMethods.time_min.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.StatsMethods.time_prod.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.StatsMethods.time_std.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.StatsMethods.time_sum.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.StatsMethods.time_var.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Temporaries.time_large.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Temporaries.time_large2.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Temporaries.time_mid.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.Temporaries.time_mid2.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.UnpackBits.time_unpackbits.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.UnpackBits.time_unpackbits_axis0.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.UnpackBits.time_unpackbits_axis1.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.UnpackBits.time_unpackbits_axis1_little.py", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.UnpackBits.time_unpackbits_little.py", ], # Interpreter supporting infra "./interpreter/harness.py": [ @@ -1546,6 +1634,16 @@ "./interpreter/tests/": [ "file:graalpython/com.oracle.graal.python.test/src/tests/__init__.py", ], + "./interpreter/data/": [ + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/data/interpreter.tar.bz2", + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/pyperformance/data/telco-bench.b", + ], + "./numpy/bench_core.py": [ + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/bench_core.py", + ], + "./numpy/common.py": [ + "file:graalpython/com.oracle.graal.python.benchmarks/python/micro/numpy/common.py", + ], # Warmup benchmarks "./warmup/": [ "file:benchmarks/warmup/*.py",