Spock
JUnit 5 vs. Spock feature showdown
Great comparison between Spock and JUnit 5.
JUnit has come a long way since version 4. Not only does version 5 present an attractive feature set it also revolutionizes the underlying runtime platform. Almost all features available in Spock have an equivalent in JUnit 5 making it enterprise-ready tooling.
@bmuschko compares:
- Test execution
- Fixture set up and tear down
- Descriptive test names
- Disabling tests
- Expecting thrown exceptions
- Repeating test execution
- Declaring test execution timeouts
- Conditional test execution
- Data-driven tests
- Mocking
- Labeling and filtering test execution
- Extending the test framework
GORM
Session Batching
Understanding Hibernate Session batching is often the key to improve a bulk import.
Batch Import Performance With Grails and MySQL
He improves the performance by focusing on table indexes, GORM cleanup and choosing the appropriate MYSQL Database engine.
I've created a repository with the code sample.
Grails - How To Create Custom Table Index Or Composite Index
In the previous linked we learned that indexes can improve heavily our database performance. Learn how to create a composite index with GORM.
Bulk Insert with Grails GORM
Akshay Chavan and Prakash Bhavnath compare different approaches for bulk inserts with GORM and Grails.
- Traditional Save
- Cleanup GORM
- Batch processing
- Hibernate Stateless Session
Note: in the blog post they call everytime save(flush: true) instead of save(). Flushing makes inserts much slower. Bear that in mind, set it to true only if you need to.
I have created a repository with sample code. From what I am seeing Hibernate StatelessSession
approach is the fastest.
A Grails Memory Leak
If you are doing Grails 2 development, you will need to call too: DomainClassGrailsPlugin.PROPERTY_INSTANCE_MAP.get().clear()
when processing your batches. Detailed explanation by @burtbeckwith.
Misc
Controlling Time
Whenever a new year starts, we aim to make the most productive version of ourselves. Time management is a skill worth mastering, more than a new programming language.
I got this link to Eden Shochat's slides through one of my favorite newsletters Software lead weekly
Comment
Happy 2018. Let us start 2018 with bulk inserts. We may be able to import efficiently our new year's resolutions. 😉
Sergio del Amo