Package com.singularsys.jeptests.unit.misc.parallelparsing

# Class ParallelParsingTest

java.lang.Object
com.singularsys.jeptests.unit.misc.parallelparsing.ParallelParsingTest

public class ParallelParsingTest extends Object
A set of tests checking different methods of parallel parsing from the `com.singularsys.jep.misc.parallelparsing` package.

Some failing tests exhibit problems with certain configurations, like using the standard `VariableTable` in parallel contexts, this are marked with the `@DisabledIfEnvironmentVariable` annotation.

Most test show the effect of different configurations on parsing the same set of equations. Name of tests are based on the configuration:

- VT = using a `VariableTable`
- CVT = using a `ConcurrentVariableTable`
- PCP = using a `ParallelConfigurableParser` in all threads;
- single_SP = using a single `StandardParser` for all threads;
- single_SCP = using a single `StandardConfigurableParser` for all threads;
- new_SP = using a new StandardParser in each thread;
- new_SCP = using a new StandardConfigurableParser in each thread;
- new_CP = using the `ConfigurableParser(Jep, ConfigurableParser)` constructor to create a new ConfigurableParser for each thread that reuses matchers from an existing instance;
- parallel_parse = using multiple threads;
- serial_parse = using a single thread.

Parsing speeds
Test | 50 | 100 | 200 | Comment
--- | --- | --- | --- | ---
Number of equations | 2600 | 10200 | 40400 |
Serial methods
test_VT_single_SCP_serial_parse() | 48ms | 145ms | 328ms | Standard Variable Table with a new Standard Configurable Parser per thread
test_VT_PCP_serial_parse() | 42ms | 110ms | 339ms | Standard Variable Table with a Parallel Configurable Parser
test_CVT_PCP_serial_parse() | 41ms | 156ms | 343ms | Concurrent Variable Table with a Parallel Configurable Parser
test_VT_single_SP_serial_parse() | 63ms | 275ms | 568ms | Standard Variable Table with single Standard Parser for all threads
test_CVT_single_SP_serial_parse() | 72ms | 226ms | 666ms | Concurrent Variable Table with a new Standard Parser per thread
Parallel methods
test_CVT_new_CP_parallel_parse() | 51ms | 85ms | 261ms | Concurrent Variable Table with a new Configurable Parser per thread
test_CVT_PCP_parallel_parse() | 66ms | 148ms | 370ms | Concurrent Variable Table with a new Parallel Configurable Parser
test_CVT_new_SCP_parallel_parse() | 128ms | 331ms | 667ms | Concurrent Variable Table with a new Standard Configurable Parser per thread
test_CVT_new_SP_parallel_parse() | 96ms | 196ms | 717ms | Concurrent Variable Table with a new Standard Parser per thread
Failing methods
test_VT_new_SCP_parallel_parse() | 76ms | FAILED | FAILED | Standard Variable Table with a new Standard Configurable Parser per thread
test_VT_PCP_parallel_parse() | FAILED | FAILED | FAILED | Standard Variable Table with a Parallel Configurable Parser
test_CVT_single_SCP_parallel_parse() | FAILED | FAILED | FAILED | Concurrent Variable Table with a single Standard Configurable Parser for all threads
test_CVT_single_SP_parallel_parse() | FAILED | FAILED | FAILED | Concurrent Variable Table with a single Standard Parser for all threads

The tests results indicate:

- There is only a marginal gain by parsing in parallel, which only comes into effect when parsing very large numbers of equations.
- To allow parallel parsing the Concurrent Variable Table must be used. The most efficient is using the `ConfigurableParser(Jep, ConfigurableParser)` constructor that reuses the set of matchers, then the `ParallelConfigurableParser` which also reuses the set of matchers. Creating a new StandardConfigurableParser for each thread is slower, and creating a new StandardParser slower still.
- You cannot reuse the same StandardParser or StandardConfigurableParser between threads.
- In a single threaded context, its marginally faster to use the standard variable table. These tests indicate the StandardConfigurableParser is faster than the StandardParser, but tests from `ParseSpeed` indicate the reverse.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `class`
  `ParallelParsingTest.AddingVariableAndConstantsTest`
  `class`
  `ParallelParsingTest.MatrixEquationsTest`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final boolean`
  `PRINT_RESULTS`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ParallelParsingTest()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static void`
  `printEnv()`
  `void`
  `setUp()`
  `void`
  `test_binomal_equations()`
  `void`
  `test_equation_sequences()`
  `void`
  `test_matrix_equations()`
  `void`
  `test_package_info()`
  `void`
  `test_package_info_new_CP()`
  `void`
  `test_parallel_parse_equation_sequences()`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### PRINT_RESULTS

    public static final boolean PRINT_RESULTS

- ## Constructor Details

  - ### ParallelParsingTest

    public ParallelParsingTest()

- ## Method Details

  - ### printEnv

    @BeforeAll public static void printEnv()

  - ### setUp

    @BeforeEach public void setUp()

  - ### test_binomal_equations

    @Test public void test_binomal_equations() throws InterruptedException
    Throws:
      `InterruptedException`

  - ### test_matrix_equations

    @Test public void test_matrix_equations() throws InterruptedException
    Throws:
      `InterruptedException`

  - ### test_equation_sequences

    @Test public void test_equation_sequences()

  - ### test_parallel_parse_equation_sequences

    @Test public void test_parallel_parse_equation_sequences() throws InterruptedException
    Throws:
      `InterruptedException`

  - ### test_package_info

    @Test public void test_package_info() throws InterruptedException
    Throws:
      `InterruptedException`

  - ### test_package_info_new_CP

    @Test public void test_package_info_new_CP() throws InterruptedException
    Throws:
      `InterruptedException`