RandomJS icon indicating copy to clipboard operation
RandomJS copied to clipboard

Optimal parameters

Open tevador opened this issue 7 years ago • 1 comments

With all the planned features implemented, the next task is to find the optimal generator options for production use.

The program generator is highly configurable - I tried to minimize the amount of hardcoded options. See ProgramOptions.xml.

The goals are

  1. Average runtime around 5-8 ms per program on a fast CPU (Ryzen/Skylake).
  2. Lowest possible 99.9th percentile (ideally under 50 ms).
  3. Maximum complexity of the program.
  4. Maximum entropy of the program output

I propose to use a combination of the following:

  1. Manual optimization. This requires certain level of knowledge of Javascript and a lot of patience.
  2. Heuristic optimization, for example Genetic algorithm. Fitness function can be created to match the above goals by measuring the runtime and some sort of complexity rating of each program (for example cyclomatic complexity or Halstead complexity).

tevador avatar May 28 '18 20:05 tevador

Tuning will be very complex and specific to CPU vendors and product line. Different chips even from the same manufacturer have different ratios of cache-to-core, different execution pipelines, different cache prediction, etc. You need to pick a specific processor (e.g. Intel Sandy Bridge) and tune just for that. Tunings for other CPU’s will vary, and I’m curious by how much. Differences of maybe 30% could make nonoptimal CPU’s unprofitable. Ultimately a system cost analysis is required not just performance metrics.

timolson avatar Oct 11 '18 16:10 timolson