Skip to content

Latest commit

 

History

History
63 lines (50 loc) · 3.19 KB

File metadata and controls

63 lines (50 loc) · 3.19 KB

Build process

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 @Test attribute before createTestCases() in IntegrationTests.java
  • 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.gradle file to enable.

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.)

Generated files

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.

Libraries

Walnut uses the following libraries:

  • fastutil: memory-efficient collections
  • dk.brics.automaton - DFA/NFA implementation
    • Much of this is not used; this library uses char primitives for states, which would mean a limit of 65536 states

Optimizations

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., int vs Integer) when possible. This is a ~2x reduction in memory usage, and saves boxing time. Objects like ArrayList only support wrappers, so instead objects like fastutil's IntArrayList are used.
  • d (the transition function) is very large. This is because it has a List instance for every state. During determinizing, there's only one state in the List, so we're able to use primitives instead for a ~8x memory saving.
  • The set of states in subsetConstruction is trimmed, to avoid storing empty space.

Documentation

  • 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

IDEs

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.