Walnut is currently built with the Gradle build system, and supports:
- Unit testing via JUnit
- Unit tests are stored in
src/test/ - Integration testing is done via the unit testing process, to show code coverage
- Integration testing runs by default. Be careful; it has the ability to overwrite some Automata text files.
- To rebuild integration test files, uncomment the
@Testattribute beforecreateTestCases()in IntegrationTests.java
- Unit tests are stored in
- Code coverage reports via JaCoCo
- Static analysis via SpotBugs
- Disabled by default, since it flags a few issues which fail the build. Uncomment the SpotBugs code in the
build.gradlefile to enable.
- Disabled by default, since it flags a few issues which fail the build. Uncomment the SpotBugs code in the
To build Walnut, run build.sh.
(Note additional comments in the file.)
To run Walnut, run run_walnut.sh.
(Note additional comments in the file.)
build.sh will create a build/ directory.
There are many files there, but in particular:
- build/libs contains the "thin" and "fat" JAR files. The fat JAR (Walnut-all.jar) packages up dependent libraries which are necessary for execution.
- build/reports/tests/test/index.html shows output of unit tests.
- build/jacocoHtml/index.html shows code coverage results.
- build/reports/spotbugs/main.html shows SpotBugs output (if enabled).
Integration tests will potentially alter several other files.
It's recommended that the integration test code be refactored,
such that all its files are generated at src/test/resources.
Walnut uses the following libraries:
- fastutil: memory-efficient collections
- dk.brics.automaton - DFA/NFA implementation
- Much of this is not used; this library uses
charprimitives for states, which would mean a limit of 65536 states
- Much of this is not used; this library uses
Heap dump analysis and profiling
show that Walnut consumes its memory and time in subsetConstruction.
Memory optimizations that improve both:
- Prefer primitives to wrappers (e.g.,
intvsInteger) when possible. This is a ~2x reduction in memory usage, and saves boxing time. Objects likeArrayListonly support wrappers, so instead objects like fastutil'sIntArrayListare used. d(the transition function) is very large. This is because it has aListinstance for every state. During determinizing, there's only one state in theList, so we're able to use primitives instead for a ~8x memory saving.- The set of states in
subsetConstructionis trimmed, to avoid storing empty space.
- Documentation/ is an old Javadoc directory. This could be rebuilt, even automatically via Gradle.
- Manual.pdf
- Walnut 5 Documentation.txt
- README.md
- developer_notes.md
Gradle is supported by several IDEs including Eclipse and IntelliJ. In particular, in IntelliJ you can simply open the Gradle file to create a project.