> On April 24, 2013, 9:37 p.m., Nathan Binkert wrote: > > src/python/m5/stats/display.py, line 177 > > <http://reviews.gem5.org/r/1643/diff/3/?file=35285#file35285line177> > > > > try/except may be faster here. I haven't benchmarked that though. > > Sascha Bischoff wrote: > I had a look, seems like try/except is very slightly slower in this case. > Very marginal though.
Huh. I must admit that I'm surprised. I'd have thought that the two lookups would have been more expensive. Perhaps failing that call is the common case. The other idiom I use is: total = getattr(self, "total", None) if total is None: total = foo.... I just don't know enough about CPython performance (beyond that it doesn't have any :) (I'm not trying to get you to change anything, just giving you ideas on improving the performance.) - Nathan ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: http://reviews.gem5.org/r/1643/#review4285 ----------------------------------------------------------- On April 25, 2013, 5 a.m., Andreas Hansson wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > http://reviews.gem5.org/r/1643/ > ----------------------------------------------------------- > > (Updated April 25, 2013, 5 a.m.) > > > Review request for Default. > > > Description > ------- > > Changeset 9714:68ea5c8f8d6c > --------------------------- > stats: Optimise the text-based stats output to improve speed > > The text-based stats output is slow than the original C++ output. This patch > addresses some of those issues by removing: > > Asserts that are not required > stats.ValueProxy, as it is no longer required > Unnecessary calls to __getattr__ and __hasattr__ > > It also changes the formula calculation to only calculate the values and > totals > of formulas if they have not been passed in from the C++. This allows other > formulas to be added, whilst ensuring that the stats output is sufficiently > fast. > > Testing has shown a 6x - 8x increase in stats output speed. > > > Diffs > ----- > > src/python/m5/stats/__init__.py 773aae0990ae > src/python/m5/stats/display.py PRE-CREATION > src/python/m5/stats/info.py PRE-CREATION > > Diff: http://reviews.gem5.org/r/1643/diff/ > > > Testing > ------- > > Ensure that the output files are identical > > > Thanks, > > Andreas Hansson > > _______________________________________________ gem5-dev mailing list [email protected] http://m5sim.org/mailman/listinfo/gem5-dev
