TradingView-exact math no longer costs speed

To match TradingView to the last digit, PyneCore computes math.log, math.exp, the trigonometric functions and a few others the same way TradingView’s runtime does, instead of leaving them to the operating system’s math library. Until now that math ran as plain Python, about ten to twenty-five times slower per call than necessary. It now ships compiled, and scripts get the same exact numbers much faster.

Each compiled function is a twin of its Python original. Before any package is published, a check on every supported platform (Linux, Windows and macOS, Intel and ARM) confirms that the two return identical bits. On a platform without a compiled build, the Python code runs and gives the same results. math.log10 and math.pow also match TradingView exactly now; until this release they were fast but slightly off.

The gain depends on how much math a script does. Among the community scripts in our validation corpus that use these functions, the typical one runs only about four percent faster, because most of its time goes to other work. Math-heavy indicators such as Nadaraya-Watson kernel envelopes run up to 2.8 times faster. The previous releases sped up multi-timeframe scripts; this one does the same for math.