Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Wed, 8 May 2013 10:17:05 +0200
From: magnum <>
To: "" <>
Subject: Avoid calling no-op function


This gains 4% in a simple test:

diff --git a/src/bench.c b/src/bench.c
index ce180c1..15dab81 100644
--- a/src/bench.c
+++ b/src/bench.c
@@ -61,6 +61,7 @@ static void bench_set_keys(struct fmt_main *format,
        char *plaintext;
        int index, length;
+       if (format->methods.clear_keys != fmt_default_clear_keys)
        length = format->params.benchmark_length;

I was benchmarking LM format in core tree but it was only a quick empirical test (ran 5 times with and without this extra line). Do you think real-life use (of same thing in cracker.c of course) could be significant? I have no idea of absolute cost for a function call (btw this was OSX). Also, at first I had that test moved out of the loop using a file-scoped variable for avoiding de-reference each time but the gain was smaller then... I'm not sure but that maybe indicates my "results" are more from other random differences than from the actual avoidance of the no-op function call?


Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.