The goal of this example project is to test the performance of Engflow's remote execution and caching service based on the number of input binary files in the dependency graph. The project contains a genrule that generates a specified number of Java binaries for the genbinary Java library, which are then listed as dependencies in the main binary. The Main.java file loops through each generated class and calls its greetNum method.
java/com/engflow/internship/binaryinput/Main.java: Main class that dynamically loads and invokes methods from generated classes.java/com/engflow/internship/binaryinput/BUILD: Bazel build file for themainjava binary and thegenbinarylibrary.
To generate the test files, build the genbinary library using the genrule:
bazel build //java/com/engflow/internship/binaryinput:genbinaryThen, the program can be run with the following command:
bazel run //java/com/engflow/internship/binaryinput:main-
Generation of Java Binaries:
- The
genrulein theBUILDfile generates a specified number of Java classes (Hello1.java,Hello2.java, ...,HelloN.java). - Each generated class contains a
greetNummethod that prints a unique message.
- The
-
Main Class Execution:
- The
Main.javafile inbinaryinputdynamically loads each generated class using reflection. - It then invokes the
greetNummethod of each class, printing the corresponding message.
- The
The number of generated files is controlled by the NUM_FILES variable in the BUILD file of the binaryinput package. Modify this variable to change the number of generated classes and observe the performance impact on Engflow's remote execution and caching service.
To generate and run the program with 10 input binary files:
- Set
NUM_FILESto 10 injava/com/engflow/internship/binaryinput/BUILD. - Build the
genbinarylibrary:bazel build //java/com/engflow/internship/binaryinput:genbinary
- Run the
mainbinary:bazel run //java/com/engflow/internship/binaryinput:main
This will generate 10 Java classes, build the genbinary library, and run the main binary, which will print messages from each generated class.