diff options
Diffstat (limited to 'benchmarks')
| -rw-r--r-- | benchmarks/bc/add.bc | 21 | ||||
| -rw-r--r-- | benchmarks/bc/arrays.bc | 38 | ||||
| -rw-r--r-- | benchmarks/bc/arrays_and_constants.bc | 38 | ||||
| -rw-r--r-- | benchmarks/bc/bitfuncs.bc | 18 | ||||
| -rw-r--r-- | benchmarks/bc/constants.bc | 41 | ||||
| -rw-r--r-- | benchmarks/bc/divide.bc | 26 | ||||
| -rw-r--r-- | benchmarks/bc/functions.bc | 38 | ||||
| -rw-r--r-- | benchmarks/bc/irand_long.bc | 12 | ||||
| -rw-r--r-- | benchmarks/bc/irand_short.bc | 9 | ||||
| -rw-r--r-- | benchmarks/bc/lib.bc | 11 | ||||
| -rw-r--r-- | benchmarks/bc/multiply.bc | 23 | ||||
| -rw-r--r-- | benchmarks/bc/postfix_incdec.bc | 11 | ||||
| -rw-r--r-- | benchmarks/bc/power.bc | 2 | ||||
| -rw-r--r-- | benchmarks/bc/strings.bc | 40 | ||||
| -rw-r--r-- | benchmarks/bc/subtract.bc | 22 | ||||
| -rw-r--r-- | benchmarks/dc/modexp.dc | 42 |
16 files changed, 392 insertions, 0 deletions
diff --git a/benchmarks/bc/add.bc b/benchmarks/bc/add.bc new file mode 100644 index 000000000000..90a83e4758d9 --- /dev/null +++ b/benchmarks/bc/add.bc @@ -0,0 +1,21 @@ +#! /usr/bin/bc -lq + +print "scale = 20\n" +print "x = 1234567890 / scale\n" +print "len = length(x) + 1 + scale\n" +print "len *= 2\n" + +scale = 20 +x = 1234567890 / scale +len = length(x) + 1 + scale +len *= 2 + +for (i = 0; i <= len; ++i) { + print "a[", i, "] = x * (10^", i, ")\n" +} + +for (i = 1; i <= 10000; ++i) { + for (j = 0; j < len; ++j) { + print "v = a[", i, "] + a[", j, "]\n" + } +} diff --git a/benchmarks/bc/arrays.bc b/benchmarks/bc/arrays.bc new file mode 100644 index 000000000000..cc0276d6ad20 --- /dev/null +++ b/benchmarks/bc/arrays.bc @@ -0,0 +1,38 @@ +#! /usr/bin/bc +# +# SPDX-License-Identifier: BSD-2-Clause +# +# Copyright (c) 2018-2021 Gavin D. Howard and contributors. +# +# 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. +# +# 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. +# + +max = 1000000 + +for (i = 0; i < max; ++i) { + print "a", i, "[0] = ", i, "\n" +} + +print "halt\n" + +halt diff --git a/benchmarks/bc/arrays_and_constants.bc b/benchmarks/bc/arrays_and_constants.bc new file mode 100644 index 000000000000..9a2172ece5be --- /dev/null +++ b/benchmarks/bc/arrays_and_constants.bc @@ -0,0 +1,38 @@ +#! /usr/bin/bc +# +# SPDX-License-Identifier: BSD-2-Clause +# +# Copyright (c) 2018-2021 Gavin D. Howard and contributors. +# +# 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. +# +# 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. +# + +max = 1000000 + +for (i = 0; i < max; ++i) { + print "b", i, "[100] = ", i, "\n" +} + +print "halt\n" + +halt diff --git a/benchmarks/bc/bitfuncs.bc b/benchmarks/bc/bitfuncs.bc new file mode 100644 index 000000000000..69d357c2ce8a --- /dev/null +++ b/benchmarks/bc/bitfuncs.bc @@ -0,0 +1,18 @@ +#! /usr/bin/bc -lq + +scale = 0 +max = 10000 + +print "scale = 0\n" + +for (i = 0; i < max; ++i) { + + a = rand() + b = rand() + + print "band(", a, ", ", b, ")\n" + print "bor(", a, ", ", b, ")\n" + print "bxor(", a, ", ", b, ")\n" + print "bshl(", a, ", ", b % 32, ")\n" + print "bshr(", a, ", ", b % 32, ")\n" +} diff --git a/benchmarks/bc/constants.bc b/benchmarks/bc/constants.bc new file mode 100644 index 000000000000..1f7b92d47566 --- /dev/null +++ b/benchmarks/bc/constants.bc @@ -0,0 +1,41 @@ +#! /usr/bin/bc +# +# SPDX-License-Identifier: BSD-2-Clause +# +# Copyright (c) 2018-2021 Gavin D. Howard and contributors. +# +# 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. +# +# 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. +# + +max = 1000 +max2 = 1000 + +for (i = 0; i < max; ++i) { + + print "c = ", i, "\n" + print "e = 0.", i, "\n" + + for (j = 0; j < max2; ++j) { + print "d = ", i, ".", j, "\n" + } +} diff --git a/benchmarks/bc/divide.bc b/benchmarks/bc/divide.bc new file mode 100644 index 000000000000..227794badbcb --- /dev/null +++ b/benchmarks/bc/divide.bc @@ -0,0 +1,26 @@ +#! /usr/bin/bc -lq + +print "scale = 20\n" +print "x = 1234567890 * 10^(-scale)\n" +print "len = 1 + 2 * scale\n" +print "scale += 10\n" + +scale = 20 +x = 1234567890 * 10^(-scale) +len = 1 + 2 * scale + +scale += 10 + +for (i = 0; i <= len; ++i) { + print "a[", i, "] = x * (10^", i, ")\n" +} + +for (i = 1; i <= 10000; ++i) { + for (j = 0; j < len; ++j) { + print "v = a[0] / a[", j, "]\n" + print "v = a[", i, "] / a[", j, "]\n" + print "v = (a[0] * ", i, ") / a[", j, "]\n" + print "v = a[0] / (a[", j, "] * ", i, ")\n" + print "v = (a[0] * ", i, ") / (a[", j, "] * ", i, ")\n" + } +} diff --git a/benchmarks/bc/functions.bc b/benchmarks/bc/functions.bc new file mode 100644 index 000000000000..7848c8df0c9f --- /dev/null +++ b/benchmarks/bc/functions.bc @@ -0,0 +1,38 @@ +#! /usr/bin/bc +# +# SPDX-License-Identifier: BSD-2-Clause +# +# Copyright (c) 2018-2021 Gavin D. Howard and contributors. +# +# 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. +# +# 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. +# + +max = 1000000 + +for (i = 0; i < max; ++i) { + print "define etsna", i, "(n) {\n\tn\n}\n" +} + +print "halt\n" + +halt diff --git a/benchmarks/bc/irand_long.bc b/benchmarks/bc/irand_long.bc new file mode 100644 index 000000000000..2d2404942f83 --- /dev/null +++ b/benchmarks/bc/irand_long.bc @@ -0,0 +1,12 @@ +#! /usr/bin/bc -lq + +start = 2^256 +end = start + 10000000 + +for (i = start; i < end; ++i) { + print "irand(", i, ")\n" +} + +print "halt\n" + +halt diff --git a/benchmarks/bc/irand_short.bc b/benchmarks/bc/irand_short.bc new file mode 100644 index 000000000000..a53d407879f3 --- /dev/null +++ b/benchmarks/bc/irand_short.bc @@ -0,0 +1,9 @@ +#! /usr/bin/bc -lq + +for (i = 2; i < 10000000; ++i) { + print "irand(", i, ")\n" +} + +print "halt\n" + +halt diff --git a/benchmarks/bc/lib.bc b/benchmarks/bc/lib.bc new file mode 100644 index 000000000000..fb7cd1b93354 --- /dev/null +++ b/benchmarks/bc/lib.bc @@ -0,0 +1,11 @@ +#! /usr/bin/bc -lq + +print "for (i = 100; i < 1000; ++i) {\n" +print " v = pi(i)\n" +print " v = e(v)\n" +print " v = l(v)\n" +print "}\n" + +print "halt\n" + +halt diff --git a/benchmarks/bc/multiply.bc b/benchmarks/bc/multiply.bc new file mode 100644 index 000000000000..d4ed08e055c8 --- /dev/null +++ b/benchmarks/bc/multiply.bc @@ -0,0 +1,23 @@ +#! /usr/bin/bc -lq + +print "scale = 20\n" +print "x = 1234567890 / scale\n" +print "len = length(x) + 1 + scale\n" + +scale = 20 +x = 1234567890 / scale +len = length(x) + 1 + scale + +for (i = 0; i <= len; ++i) { + print "a[", i, "] = x * (10^", i, ")\n" +} + +for (i = 1; i <= 10000; ++i) { + for (j = 0; j < len; ++j) { + print "v = a[0] * a[", j, "]\n" + print "v = a[", i, "] * a[", j, "]\n" + print "v = (a[0] * ", i, ") * a[", j, "]\n" + print "v = a[0] * (a[", j, "] * ", i, ")\n" + print "v = (a[0] * ", i, ") * (a[", j, "] * ", i, ")\n" + } +} diff --git a/benchmarks/bc/postfix_incdec.bc b/benchmarks/bc/postfix_incdec.bc new file mode 100644 index 000000000000..2437f4c4c820 --- /dev/null +++ b/benchmarks/bc/postfix_incdec.bc @@ -0,0 +1,11 @@ +#! /usr/bin/bc -lq + +max = 1000000 + +for (i = 0; i < max; ++i) { + print "i++\ni--\n" +} + +print "halt\n" + +halt diff --git a/benchmarks/bc/power.bc b/benchmarks/bc/power.bc new file mode 100644 index 000000000000..b067aa732d10 --- /dev/null +++ b/benchmarks/bc/power.bc @@ -0,0 +1,2 @@ +#! /usr/bin/bc -lq + diff --git a/benchmarks/bc/strings.bc b/benchmarks/bc/strings.bc new file mode 100644 index 000000000000..a97017ea78b4 --- /dev/null +++ b/benchmarks/bc/strings.bc @@ -0,0 +1,40 @@ +#! /usr/bin/bc +# +# SPDX-License-Identifier: BSD-2-Clause +# +# Copyright (c) 2018-2021 Gavin D. Howard and contributors. +# +# 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. +# +# 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. +# + +max = 1000000 + +print "\qasotehnuasnotehustnaoheusntaoheustnaoheusntaoehunsatoheuastoehuaosnetuhaosetnuhaosentuahoesntuahoeuhstoeunhatoehusanotehusatnoheus\q\n" + +for (i = 0; i < max; ++i) { + print "\qabc", i, " = ", i, "\\n\q\n" +} + +print "halt\n" + +halt diff --git a/benchmarks/bc/subtract.bc b/benchmarks/bc/subtract.bc new file mode 100644 index 000000000000..b88bd60e935c --- /dev/null +++ b/benchmarks/bc/subtract.bc @@ -0,0 +1,22 @@ +#! /usr/bin/bc -lq + +print "scale = 20\n" +print "x = 1234567890 / scale\n" +print "len = length(x) + 1 + scale\n" +print "len *= 2\n" + +scale = 20 +x = 1234567890 / scale +len = length(x) + 1 + scale +len *= 2 + +for (i = 0; i <= len; ++i) { + print "a[", i, "] = x * (10^", i, ")\n" +} + +for (i = 1; i <= 10000; ++i) { + for (j = 0; j < len; ++j) { + print "v = a[", i, "] - a[", j, "]\n" + } +} + diff --git a/benchmarks/dc/modexp.dc b/benchmarks/dc/modexp.dc new file mode 100644 index 000000000000..48f304cb92da --- /dev/null +++ b/benchmarks/dc/modexp.dc @@ -0,0 +1,42 @@ +#! /usr/bin/dc +# +# SPDX-License-Identifier: BSD-2-Clause +# +# Copyright (c) 2018-2021 Gavin D. Howard and contributors. +# +# 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. +# +# 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. + +[ ]ss +[|]so +100sm 0si +[ + li1+si 0sj + [ + lj1+sj 0sk + [ + lk1+sk lin lsn ljn lsn lkn lsn lon 10P lk lm !<z + ]dszx + lj lm !<y + ]dsyx + li lm !<x +]dsxx |
