evanphx/benchmark-ips — pull request #11 by davy (2014-05-17 23:31:29+00:00)
Title: Refactoring

I'm writing a benchmarking gem that is going to be relying on a lot of the features in the benchmark-ips gem, and in order to more easily extend the behavior of benchmark-ips more easily I made some reorganizations of the benchmark-ips code. The functionality of the gem should be generally unchanged.

* Fixed hoe rake tasks that were broken due to the change from README.txt to README.md
* Made the bin/benchmark-ips executable run the example code in the README, which aids in general testing
* Added Travis CI support
* Switched over to Minitest
* Added additional ways to access the configuration options of `Benchmark.ips` besides simply `Benchmark.ips(time, warmup)`. Documented in README.
* General refactoring / DRYing of the code
* Pulling more responsibility into `IPSJob`, split `IPSJob` into it's own file
* Pulled `IPSReport` into it's own file
* Created `IPSReportList` to hold the `IPSReports`, instead of just an array in `IPSJob`
* Interface of `Benchmark.ips` remains the same

### Possible Future Improvements?

In doing some refactoring of `IPSReport`, what I really wanted to have was `IPSJob` holding a reference to an `IPSReport`, which then had a bunch of `IPSReport::Entry` objects. But this would break the interface to `Benchmark.ips`, as it returns an array of `IPSReport` objects. So I didn't make this change. Instead I created a `IPSReportList`, which unfortunately sounds pretty Java-esque. I looked around to see if any open source code was using the list of `IPSReport` objects that was being returned in any way, and I didn't find anything, but that doesn't mean that changing this interface won't break people's code.

Now that `IPSReportList` exists, it could make sense to pull the code located in `Benchmark.compare` into `IPSReportList`.

Another thought was changing the namespacing in general to look like:

```
module Benchmark::IPS
class Benchmark::IPS::Job
class Benchmark::IPS::Job::Entry
class Benchmark::IPS::Report
class Benchmark::IPS::Report::Entry
```