kelseyhightower / nocode

The best way to write secure and reliable applications. Write nothing; deploy nowhere.
Apache License 2.0
60.39k stars 4.71k forks source link

Please add memoization #1820

Open andrewbanchich opened 6 years ago

andrewbanchich commented 6 years ago

The current implementation of nocode could be executed far more efficiently by adding memoization. Because the entry point is a pure function, it is able to be memoized. This would insure that any subsequent executions of nocode would return

instantly without having to process anything.

My thoughts were something like:

const main = x => {
  const memo = {};
  if (memo.x) {
    return memo.x;
  } else {
    memo.x = ;
    return ;
  }
};
axelsimon commented 6 years ago

I'm afraid your suggestion doesn't fit with the project's coding standards.

Remember, acceptable forms of code for nocode are ` and `

Please keep this in mind when suggesting improvements.

andrewbanchich commented 6 years ago

@axelsimon Okay, my mistake! I refactored my code. How is this?

axelsimon commented 6 years ago

:+1: