README.md in multisert-0.0.1 vs README.md in multisert-0.0.2
- old
+ new
@@ -1,8 +1,9 @@
# Multisert
-TODO: Write a gem description
+Multisert is a buffer that handles bundling up INSERTs, which increases runtime
+performance.
## Installation
Add this line to your application's Gemfile:
@@ -68,10 +69,56 @@
attribute). One last thing to note is the `buffer.flush!` at the end of the
script. This ensures that any pending entries are written to the database table
that were not automatically taken care of by the auto-flush that will kick in
during the iteration.
+## Performance
+
+The gem has a quick performance test built in that can be run via:
+```bash
+$ ruby ./performance/multisert_performance_test
+```
+We ran the performance test (with some modification to iterate the test 5
+times) and receive the following output:
+
+```bash
+$ ruby ./performance/multisert_performance_test
+# test 1:
+# insert w/o buffer took 53.37s to insert 100000 entries
+# multisert w/ buffer of 10000 took 1.77s to insert 100000 entries
+#
+# test 2:
+# insert w/o buffer took 53.22s to insert 100000 entries
+# multisert w/ buffer of 10000 took 1.84s to insert 100000 entries
+#
+# test 3:
+# insert w/o buffer took 54.42s to insert 100000 entries
+# multisert w/ buffer of 10000 took 1.9s to insert 100000 entries
+#
+# test 4:
+# insert w/o buffer took 53.38s to insert 100000 entries
+# multisert w/ buffer of 10000 took 1.81s to insert 100000 entries
+#
+# test 5:
+# insert w/o buffer took 53.52s to insert 100000 entries
+# multisert w/ buffer of 10000 took 1.78s to insert 100000 entries
+```
+
+As we can see, ~30x performance increase.
+
+The performance test was run on a computer with the following specs:
+
+ Model Name: MacBook Air
+ Model Identifier: MacBookAir4,2
+ Processor Name: Intel Core i5
+ Processor Speed: 1.7 GHz
+ Number of Processors: 1
+ Total Number of Cores: 2
+ L2 Cache (per Core): 256 KB
+ L3 Cache: 3 MB
+ Memory: 4 GB
+
## FAQ
### Packet Too Large / Connection Lost Errors
You may run into the "Packet Too Large" error when attempting to run a
@@ -81,12 +128,42 @@
To learn more, [read the documentation](http://dev.mysql.com/doc/refman/5.5/en//packet-too-large.html).
If you need to you can adjust the buffer size by setting `max_buffer_count`
attribute. Generally, 10,000 to 100,000 is a pretty good starting range.
+### Does it work with Dates?
+
+Yes, just pass in a Date instance and it will be converted to a mysql
+friendly format under the hood ("%Y-%m-%d"). If you need a special format,
+convert the date to a string that is in the form you want before passing it into
+Multisert.
+
+### Does it work with Times?
+
+Yes, just pass in a Time instance and it will be converted to a mysql
+friendly format under the hood ("%Y-%m-%d %H:%M:%S"). If you need a special
+format, convert the time to a string that is in the form you want before passing
+it into Multisert.
+
## Contributing
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Added some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request
+
+## License
+
+Copyright 2013 Jeff Iacono
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.