diff --git a/graalpython/com.oracle.graal.python.benchmarks/python/micro/list-comp2.py b/graalpython/com.oracle.graal.python.benchmarks/python/micro/list-comp2.py new file mode 100644 index 0000000000..e6048d9b53 --- /dev/null +++ b/graalpython/com.oracle.graal.python.benchmarks/python/micro/list-comp2.py @@ -0,0 +1,39 @@ +# Copyright (c) 2017, 2026, Oracle and/or its affiliates. +# Copyright (c) 2013, Regents of the University of California +# +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, are +# permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# 2. 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. +# +# 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 HOLDER 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. +# micro benchmark: list comprehension + + +def make_lists(num): + for i in range(num): + ll = [i for i in range(10)] + + return ll[-1] + + +def measure(num): + return make_lists(num) # 50000 + + +def __benchmark__(num=5000): + return measure(num) diff --git a/mx.graalpython/copyrights/overrides b/mx.graalpython/copyrights/overrides index 89a9959ddd..fab68d4aed 100644 --- a/mx.graalpython/copyrights/overrides +++ b/mx.graalpython/copyrights/overrides @@ -48,6 +48,7 @@ graalpython/com.oracle.graal.python.benchmarks/python/micro/generator-parallel.p graalpython/com.oracle.graal.python.benchmarks/python/micro/generator-sized.py,zippy.copyright graalpython/com.oracle.graal.python.benchmarks/python/micro/genexp-builtin-call-sized.py,zippy.copyright graalpython/com.oracle.graal.python.benchmarks/python/micro/list-comp.py,zippy.copyright +graalpython/com.oracle.graal.python.benchmarks/python/micro/list-comp2.py,zippy.copyright graalpython/com.oracle.graal.python.benchmarks/python/micro/list-indexing.py,zippy.copyright graalpython/com.oracle.graal.python.benchmarks/python/micro/list-iterating-explicit.py,zippy.copyright graalpython/com.oracle.graal.python.benchmarks/python/micro/list-iterating.py,zippy.copyright diff --git a/mx.graalpython/mx_graalpython_bench_param.py b/mx.graalpython/mx_graalpython_bench_param.py index 3c90e63435..67e6b662fd 100644 --- a/mx.graalpython/mx_graalpython_bench_param.py +++ b/mx.graalpython/mx_graalpython_bench_param.py @@ -78,6 +78,7 @@ 'generator-sized': ITER_10 + ['30_000'], 'genexp-builtin-call-sized': ITER_10 + ['50_000'], 'list-comp': ITER_10 + ['5000'], + 'list-comp2': ITER_10 + ['100_000_000'], 'list-indexing': ITER_10 + ['1000000'], 'list-indexing-from-constructor': ITER_10 + ['10000000'], 'list-indexing-from-literal': ITER_10 + ['10000000'], @@ -154,6 +155,7 @@ 'generator-sized': ITER_10 + WARMUP_2 + ['3000', '500'], 'genexp-builtin-call-sized': ITER_10 + WARMUP_2 + ['3000', '500'], 'list-comp': ITER_15 + WARMUP_2 + ['25'], + 'list-comp2': ITER_15 + WARMUP_2 + ['1000000'], 'list-indexing': ITER_6 + WARMUP_2 + ['10_000'], 'list-indexing-from-constructor': ITER_6 + WARMUP_2 + ['250_000'], 'list-indexing-from-literal': ITER_6 + WARMUP_2 + ['250_000'],