mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-03-13 03:05:12 +01:00
gobject/performance: normalize base factors for test runs
When running the test (without parameters), it estimates a factor for the run size for each test. That is useful for running a reasonable size of the test, on different machines. However, when comparing two runs, it seems important that both runs share a common factor. Otherwise, the factor is determined differently, and the test is less comparable. For that there is the "--factor" option or the GLIB_PERFORMANCE_FACTOR environment variable. However, the factor option can only set the factors for all tests at the same time. Optimally, one factor is roughly suitable for all tests, but it is not, as currently the detected factors on my machine are widely different $ ./build/gobject/tests/performance/performance -v > p $ cat p | sed -n -e 's/^Running test //p' -e 's/.*correction factor //p' | sed 'N;s/\n/ /' simple-construction 34.78 simple-construction1 145.45 complex-construction 11.08 complex-construction1 20.46 complex-construction2 23.74 finalization 4.74 type-check 37.74 emit-unhandled 5.63 emit-unhandled-empty 49.69 emit-unhandled-generic 7.17 emit-unhandled-generic-empty 50.63 emit-unhandled-args 5.20 emit-handled 3.86 emit-handled-empty 4.01 emit-handled-generic 3.96 emit-handled-generic-empty 7.04 emit-handled-args 3.78 notify-unhandled 52.63 notify-by-pspec-unhandled 156.86 notify-handled 2.55 notify-by-pspec-handled 2.66 property-set 34.63 property-get 32.92 refcount 0.83 refcount-1 2.30 refcount-toggle 1.33 Adjust the base factors with these measurements. PERFORMANCE_FILE="./gobject/tests/performance/performance.c" IFS=$'\n' for LINE in $(cat p | sed -n -e 's/^Running test //p' -e 's/.*correction factor //p' | sed 'N;s/\n/ /') ; do ( IFS=' ' set -- $LINE TESTNAME="$1" FACTOR="$2" LINENUMBER="$(grep -n "^ \"$TESTNAME\",$" "$PERFORMANCE_FILE" | cut -d: -f1)" LINENUMBER=$((LINENUMBER + 2)) OLD_FACTOR="$(sed -n "$LINENUMBER s/^ \([0-9]\+\),$/\1/p" "$PERFORMANCE_FILE")" NEW_FACTOR="$(awk -v factor="$FACTOR" -v old_factor="$OLD_FACTOR" 'BEGIN {print int(factor * old_factor + 0.5)}')" sed -i "$LINENUMBER s/^ \([0-9]\+\),$/ $NEW_FACTOR,/" "$PERFORMANCE_FILE" ) done Afterwards, we get comparable factors: $ ./build/gobject/tests/performance/performance -v > p2 $ cat p2 | sed -n -e 's/^Running test //p' -e 's/.*correction factor //p' | sed 'N;s/\n/ /' simple-construction 0.98 simple-construction1 0.75 complex-construction 0.99 complex-construction1 0.96 complex-construction2 1.02 finalization 1.05 type-check 0.98 emit-unhandled 1.01 emit-unhandled-empty 1.10 emit-unhandled-generic 1.03 emit-unhandled-generic-empty 1.07 ... Of course, this measurement was taken in my setup. But I think it brings the base factors into a comparable range for most users. Also, the commit message shows an ugly script how you can re-generate this for your own purposes.
This commit is contained in:
parent
0e1597ffb9
commit
1c9d54d4ea
@ -1371,7 +1371,7 @@ static PerformanceTest tests[] = {
|
||||
{
|
||||
"simple-construction",
|
||||
simple_object_get_type,
|
||||
10000,
|
||||
347800,
|
||||
test_construction_setup,
|
||||
test_construction_init,
|
||||
test_construction_run,
|
||||
@ -1382,7 +1382,7 @@ static PerformanceTest tests[] = {
|
||||
{
|
||||
"simple-construction1",
|
||||
simple_object_get_type,
|
||||
10000,
|
||||
1454500,
|
||||
test_construction_setup,
|
||||
test_construction_init,
|
||||
test_construction_run1,
|
||||
@ -1393,7 +1393,7 @@ static PerformanceTest tests[] = {
|
||||
{
|
||||
"complex-construction",
|
||||
complex_object_get_type,
|
||||
10000,
|
||||
110800,
|
||||
test_construction_setup,
|
||||
test_construction_init,
|
||||
test_complex_construction_run,
|
||||
@ -1404,7 +1404,7 @@ static PerformanceTest tests[] = {
|
||||
{
|
||||
"complex-construction1",
|
||||
complex_object_get_type,
|
||||
10000,
|
||||
204600,
|
||||
test_construction_setup,
|
||||
test_construction_init,
|
||||
test_complex_construction_run1,
|
||||
@ -1415,7 +1415,7 @@ static PerformanceTest tests[] = {
|
||||
{
|
||||
"complex-construction2",
|
||||
complex_object_get_type,
|
||||
10000,
|
||||
237400,
|
||||
test_construction_setup,
|
||||
test_construction_init,
|
||||
test_complex_construction_run2,
|
||||
@ -1426,7 +1426,7 @@ static PerformanceTest tests[] = {
|
||||
{
|
||||
"finalization",
|
||||
simple_object_get_type,
|
||||
10000,
|
||||
47400,
|
||||
test_construction_setup,
|
||||
test_finalization_init,
|
||||
test_finalization_run,
|
||||
@ -1437,7 +1437,7 @@ static PerformanceTest tests[] = {
|
||||
{
|
||||
"type-check",
|
||||
NULL,
|
||||
50,
|
||||
1887,
|
||||
test_type_check_setup,
|
||||
test_type_check_init,
|
||||
test_type_check_run,
|
||||
@ -1448,7 +1448,7 @@ static PerformanceTest tests[] = {
|
||||
{
|
||||
"emit-unhandled",
|
||||
GUINT_TO_POINTER (COMPLEX_SIGNAL),
|
||||
10000,
|
||||
56300,
|
||||
test_emission_unhandled_setup,
|
||||
test_emission_unhandled_init,
|
||||
test_emission_run,
|
||||
@ -1459,7 +1459,7 @@ static PerformanceTest tests[] = {
|
||||
{
|
||||
"emit-unhandled-empty",
|
||||
GUINT_TO_POINTER (COMPLEX_SIGNAL_EMPTY),
|
||||
10000,
|
||||
496900,
|
||||
test_emission_unhandled_setup,
|
||||
test_emission_unhandled_init,
|
||||
test_emission_run,
|
||||
@ -1470,7 +1470,7 @@ static PerformanceTest tests[] = {
|
||||
{
|
||||
"emit-unhandled-generic",
|
||||
GUINT_TO_POINTER (COMPLEX_SIGNAL_GENERIC),
|
||||
10000,
|
||||
71700,
|
||||
test_emission_unhandled_setup,
|
||||
test_emission_unhandled_init,
|
||||
test_emission_run,
|
||||
@ -1481,7 +1481,7 @@ static PerformanceTest tests[] = {
|
||||
{
|
||||
"emit-unhandled-generic-empty",
|
||||
GUINT_TO_POINTER (COMPLEX_SIGNAL_GENERIC_EMPTY),
|
||||
10000,
|
||||
506300,
|
||||
test_emission_unhandled_setup,
|
||||
test_emission_unhandled_init,
|
||||
test_emission_run,
|
||||
@ -1492,7 +1492,7 @@ static PerformanceTest tests[] = {
|
||||
{
|
||||
"emit-unhandled-args",
|
||||
GUINT_TO_POINTER (COMPLEX_SIGNAL_ARGS),
|
||||
10000,
|
||||
52000,
|
||||
test_emission_unhandled_setup,
|
||||
test_emission_unhandled_init,
|
||||
test_emission_run_args,
|
||||
@ -1503,7 +1503,7 @@ static PerformanceTest tests[] = {
|
||||
{
|
||||
"emit-handled",
|
||||
GUINT_TO_POINTER (COMPLEX_SIGNAL),
|
||||
10000,
|
||||
38600,
|
||||
test_emission_handled_setup,
|
||||
test_emission_handled_init,
|
||||
test_emission_run,
|
||||
@ -1514,7 +1514,7 @@ static PerformanceTest tests[] = {
|
||||
{
|
||||
"emit-handled-empty",
|
||||
GUINT_TO_POINTER (COMPLEX_SIGNAL_EMPTY),
|
||||
10000,
|
||||
40100,
|
||||
test_emission_handled_setup,
|
||||
test_emission_handled_init,
|
||||
test_emission_run,
|
||||
@ -1525,7 +1525,7 @@ static PerformanceTest tests[] = {
|
||||
{
|
||||
"emit-handled-generic",
|
||||
GUINT_TO_POINTER (COMPLEX_SIGNAL_GENERIC),
|
||||
10000,
|
||||
39600,
|
||||
test_emission_handled_setup,
|
||||
test_emission_handled_init,
|
||||
test_emission_run,
|
||||
@ -1536,7 +1536,7 @@ static PerformanceTest tests[] = {
|
||||
{
|
||||
"emit-handled-generic-empty",
|
||||
GUINT_TO_POINTER (COMPLEX_SIGNAL_GENERIC_EMPTY),
|
||||
10000,
|
||||
70400,
|
||||
test_emission_handled_setup,
|
||||
test_emission_handled_init,
|
||||
test_emission_run,
|
||||
@ -1547,7 +1547,7 @@ static PerformanceTest tests[] = {
|
||||
{
|
||||
"emit-handled-args",
|
||||
GUINT_TO_POINTER (COMPLEX_SIGNAL_ARGS),
|
||||
10000,
|
||||
37800,
|
||||
test_emission_handled_setup,
|
||||
test_emission_handled_init,
|
||||
test_emission_run_args,
|
||||
@ -1558,7 +1558,7 @@ static PerformanceTest tests[] = {
|
||||
{
|
||||
"notify-unhandled",
|
||||
complex_object_get_type,
|
||||
10000,
|
||||
526300,
|
||||
test_notify_unhandled_setup,
|
||||
test_notify_unhandled_init,
|
||||
test_notify_run,
|
||||
@ -1569,7 +1569,7 @@ static PerformanceTest tests[] = {
|
||||
{
|
||||
"notify-by-pspec-unhandled",
|
||||
complex_object_get_type,
|
||||
10000,
|
||||
1568600,
|
||||
test_notify_unhandled_setup,
|
||||
test_notify_unhandled_init,
|
||||
test_notify_by_pspec_run,
|
||||
@ -1580,7 +1580,7 @@ static PerformanceTest tests[] = {
|
||||
{
|
||||
"notify-handled",
|
||||
complex_object_get_type,
|
||||
10000,
|
||||
25500,
|
||||
test_notify_handled_setup,
|
||||
test_notify_handled_init,
|
||||
test_notify_run,
|
||||
@ -1591,7 +1591,7 @@ static PerformanceTest tests[] = {
|
||||
{
|
||||
"notify-by-pspec-handled",
|
||||
complex_object_get_type,
|
||||
10000,
|
||||
26600,
|
||||
test_notify_handled_setup,
|
||||
test_notify_handled_init,
|
||||
test_notify_by_pspec_run,
|
||||
@ -1602,7 +1602,7 @@ static PerformanceTest tests[] = {
|
||||
{
|
||||
"property-set",
|
||||
complex_object_get_type,
|
||||
10000,
|
||||
346300,
|
||||
test_set_setup,
|
||||
test_set_init,
|
||||
test_set_run,
|
||||
@ -1613,7 +1613,7 @@ static PerformanceTest tests[] = {
|
||||
{
|
||||
"property-get",
|
||||
complex_object_get_type,
|
||||
10000,
|
||||
329200,
|
||||
test_get_setup,
|
||||
test_get_init,
|
||||
test_get_run,
|
||||
@ -1624,7 +1624,7 @@ static PerformanceTest tests[] = {
|
||||
{
|
||||
"refcount",
|
||||
NULL,
|
||||
100000,
|
||||
83000,
|
||||
test_refcount_setup,
|
||||
test_refcount_init,
|
||||
test_refcount_run,
|
||||
@ -1635,7 +1635,7 @@ static PerformanceTest tests[] = {
|
||||
{
|
||||
"refcount-1",
|
||||
NULL,
|
||||
100000,
|
||||
230000,
|
||||
test_refcount_setup,
|
||||
test_refcount_init,
|
||||
test_refcount_1_run,
|
||||
@ -1646,7 +1646,7 @@ static PerformanceTest tests[] = {
|
||||
{
|
||||
"refcount-toggle",
|
||||
NULL,
|
||||
100000,
|
||||
133000,
|
||||
test_refcount_setup,
|
||||
test_refcount_init,
|
||||
test_refcount_1_run,
|
||||
|
Loading…
x
Reference in New Issue
Block a user