Result.get_changes_table - lessisbetter only defined in inner loop

4 views
Skip to first unread message

Reiner Gerecke

unread,
Dec 10, 2011, 8:52:54 AM12/10/11
to codespeed
Hi,

sorry for the subject, I have no idea how to explain that in short
terms.

I'm working on improving the performance of that function and stumpled
across a problem in the 2 nested loops. The outer loop[1] iterates
over all unique units and stores information such as hasmin/hasmax/
has_stddev. These become true, when any of the results for the
benchmarks[2] have a minimum/maximum/stddev value set[3].

It is different for lessisbetter. It is not defined in the outer loop,
but in the inner loop, where it is overwritten by each benchmark.
Still, it is used after the inner loop[4]. Because of that, only the
lessisbetter value of the last benchmark will be used, ignoring all
others. That doesn't seem right, am I missing something here?


Regards,
Reiner


[1]: https://github.com/tobami/codespeed/blob/master/codespeed/models.py#L318
[2]: https://github.com/tobami/codespeed/blob/master/codespeed/models.py#L326
[3]: https://github.com/tobami/codespeed/blob/master/codespeed/models.py#L334
[4]: https://github.com/tobami/codespeed/blob/master/codespeed/models.py#L415

Miquel Torres

unread,
Dec 12, 2011, 5:01:21 AM12/12/11
to code...@googlegroups.com
hi,

ok, that is maybe a bit confusing. I think as we are looping over
benchmarks which have the same type of units, it is asumed that all
"lessisbetter" values will be the same for all benchmarks, thus the
last loop is as good as any.


2011/12/10 Reiner Gerecke <mr.s...@googlemail.com>:

Reiner Gerecke

unread,
Dec 12, 2011, 5:06:50 AM12/12/11
to codespeed
Okay, under that assumption it makes sense. Thank you.

On Dec 12, 11:01 am, Miquel Torres <tob...@googlemail.com> wrote:
> hi,
>
> ok, that is maybe a bit confusing. I think as we are looping over
> benchmarks which have the same type of units, it is asumed that all
> "lessisbetter" values will be the same for all benchmarks, thus the
> last loop is as good as any.
>

> 2011/12/10 Reiner Gerecke <mr.squ...@googlemail.com>:

Miquel Torres

unread,
Dec 12, 2011, 6:26:42 AM12/12/11
to code...@googlegroups.com
Yeah, though it is no excuse for not adding at least a nice comment to
the code explaining it ;-)


2011/12/12 Reiner Gerecke <mr.s...@googlemail.com>:

Reply all
Reply to author
Forward
0 new messages