[glib] Added g_utf8_validate() to UTF-8 performance testing
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] Added g_utf8_validate() to UTF-8 performance testing
- Date: Fri, 5 Jun 2015 19:41:23 +0000 (UTC)
commit 5bc0bc2fdeb8a7c7bb56fabbd8886b56bf34c85b
Author: Mikhail Zabaluev <mikhail zabaluev gmail com>
Date: Tue Oct 14 01:25:56 2014 +0300
Added g_utf8_validate() to UTF-8 performance testing
https://bugzilla.gnome.org/show_bug.cgi?id=738504
glib/tests/utf8-performance.c | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/glib/tests/utf8-performance.c b/glib/tests/utf8-performance.c
index 20e5e02..d314285 100644
--- a/glib/tests/utf8-performance.c
+++ b/glib/tests/utf8-performance.c
@@ -142,6 +142,24 @@ grind_utf8_to_ucs4_fast_sized (const char *str, gsize len)
return 0;
}
+static int
+grind_utf8_validate (const char *str, gsize len)
+{
+ int i;
+ for (i = 0; i < NUM_ITERATIONS; i++)
+ g_utf8_validate (str, -1, NULL);
+ return 0;
+}
+
+static int
+grind_utf8_validate_sized (const char *str, gsize len)
+{
+ int i;
+ for (i = 0; i < NUM_ITERATIONS; i++)
+ g_utf8_validate (str, len, NULL);
+ return 0;
+}
+
static void
perform_for (GrindFunc grind_func, const char *str, const char *label)
{
@@ -192,6 +210,8 @@ main (int argc, char **argv)
g_test_add_data_func ("/utf8/perf/utf8_to_ucs4-sized", grind_utf8_to_ucs4_sized, perform);
g_test_add_data_func ("/utf8/perf/utf8_to_ucs4_fast", grind_utf8_to_ucs4_fast, perform);
g_test_add_data_func ("/utf8/perf/utf8_to_ucs4_fast-sized", grind_utf8_to_ucs4_fast_sized, perform);
+ g_test_add_data_func ("/utf8/perf/utf8_validate", grind_utf8_validate, perform);
+ g_test_add_data_func ("/utf8/perf/utf8_validate-sized", grind_utf8_validate_sized, perform);
}
return g_test_run ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]