VirtualBox

source: kBuild/trunk/src/grep/tests/mb-non-UTF8-performance

Last change on this file was 3529, checked in by bird, 3 years ago

Imported grep 3.7 from grep-3.7.tar.gz (sha256: c22b0cf2d4f6bbe599c902387e8058990e1eee99aef333a203829e5fd3dbb342), applying minimal auto-props.

  • Property svn:executable set to *
File size: 1.7 KB
Line 
1#!/bin/sh
2# grep-2.17 would take nearly 200x longer to run the command below.
3# The 200x is on an Intel i7-based system.
4# On an AMD FX-4100, it would take up to 2500x longer.
5
6# Copyright 2014-2021 Free Software Foundation, Inc.
7
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU General Public License as published by
10# the Free Software Foundation, either version 3 of the License, or
11# (at your option) any later version.
12
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU General Public License for more details.
17
18# You should have received a copy of the GNU General Public License
19# along with this program. If not, see <https://www.gnu.org/licenses/>.
20
21. "${srcdir=.}/init.sh"; path_prepend_ ../src
22
23fail=0
24
25# This test is susceptible to failure due to differences in
26# system load during the two test runs, so we'll mark it as
27# "expensive", making it less likely to be run by regular users.
28expensive_
29
30# Make the input large enough so that even on high-end systems
31# the unibyte test takes at least 10ms of user time.
32n_lines=100000
33while :; do
34 yes $(printf '%078d' 0) | sed ${n_lines}q > in || framework_failure_
35 ubyte_ms=$(LC_ALL=C user_time_ 1 grep -i foobar in) || fail=1
36 test $ubyte_ms -ge 10 && break
37 n_lines=$(expr $n_lines + 200000)
38done
39
40require_JP_EUC_locale_
41mbyte_ms=$(user_time_ 1 grep -i foobar in) || fail=1
42
43# The duration of the multi-byte run must be no more than 30 times
44# that of the single-byte one.
45# A multiple of 3 seems to be enough for i5,i7, but AMD needs >25.
46returns_ 1 expr $ubyte_ms '<' $mbyte_ms / 30 || fail=1
47
48Exit $fail
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette