commit baebdb21cf6ebbe710bde189dd3d300610fb40c8
Author: Heikki Linnakangas <heikki.linnakangas@iki.fi>
Date:   Sun Dec 23 00:11:52 2018 +0200

    benchmarking code for textpos.

diff --git a/src/test/regress/regress.c b/src/test/regress/regress.c
index a2e57768d40..59957db586f 100644
--- a/src/test/regress/regress.c
+++ b/src/test/regress/regress.c
@@ -863,3 +863,21 @@ test_fdw_handler(PG_FUNCTION_ARGS)
 	elog(ERROR, "test_fdw_handler is not implemented");
 	PG_RETURN_NULL();
 }
+
+
+PG_FUNCTION_INFO_V1(benchmark_textpos);
+Datum
+benchmark_textpos(PG_FUNCTION_ARGS)
+{
+	text	   *t1 = PG_GETARG_TEXT_PP(0);
+	text	   *t2 = PG_GETARG_TEXT_PP(1);
+	int			loops = PG_GETARG_INT32(2);
+	int			i;
+	Datum		result = Int32GetDatum(0);
+
+	for (i = 0; i < loops; i++)
+	{
+		result = DirectFunctionCall2Coll(textpos, PG_GET_COLLATION(), PointerGetDatum(t1), PointerGetDatum(t2));
+	}
+	return result;
+}
