Very Slow Calculation Time for just One Cell in 2 Year Project?
Very Slow Calculation Time for just One Cell in 2 Year Project?
I'm hoping someone can figure out what is going on otherwise 2 yrs of hard work is about to go down the drain. I’ve spent the last wk deleting and recreating tables, charts, one at a time and referencing tables to see their impact on the excessively slow calculation time of one cell, all to no avail.
I have only just noticed a sudden increase in calc time to 15+ seconds in (Trade Position 1, row 4), aka Leg 1, in the “Option Premium” green cell Y4. Calc times for Y4 in earlier version = 3 - 5 secs.
The speed issue only happens for that first row 4, Leg 1 (one of ten Legs) — and only when the asset price in E4 is changed and only for this sole one (of eight inputs) in row 4, Leg 1, no other blue celled inputs for either row 2, Leg 1 or and other the other 9 Legs are slow -- all 1-2 secs.
In tab, "10x Option P&L Strategy v138" there is a top left blue bordered table called “Initial Strategy — Tied to 10 x BSM Engines.”
Inputs go in the blue cells cols E - M. The only input for all 10 Legs that is producing a slow output in the new “Option Pr” calculation in column Y — is for Y4, Leg 1. Col Y outputs are calculated in a tab called 10 x BSM Engines that has 20 tables to calculate option premiums for any given change in the input factor like asset price or Rate changes.
Changes to the Option premium are only slow for this cell: E4. All other changes in the asset prices for all the other 9 Legs made in cells E6, E8, to E22 ( Leg 10) take 1 second to get a result in Y6, Y8, et c to Y22 (Leg 10).
Changing the underlying asset price in column E for rows 6, 8, 10 to row 22 (Legs 2, Leg 3, Leg 4 to Leg 10) or changes to the other columns in blue like date changes, implied volatility or Interest rates moves gives a 1 second update in the green “Option Pr” cells Y4 to Y22.
I’m on v138 and around the v100 there were a lot of times where I was seeing an autosave warning that the document could not be saved. Maybe I hit save whilst the calculator was doing some number crunching or I’d done some major editing, I am not sure but there was a point where between v100 and v101 the Leg 1, Y4 calculation time went from about 3 to 5 seconds to sometimes 15 - 20 seconds.
Changing any factor input in the blue cells for any of the 10 positions will result in a result in the Y column (except Y4) in about a second, maybe two…except when cell E4’s asset price is changed and Y4 starts its slow process of updating the “Option Pr” in cell Y4… Only that cell E4 being altered will cause a lag of sometimes up to 15+ seconds to produce an answer in Y4.
There is nothing special about the asset price E4 because I have deleted all dependencies on the E4 asset price cell. It has been used to provide the reference for building the x-axis asset price range for 12 charts. I disconnected it from that task when the speed issue happened (but it didn’t help or make any difference to Y4 times) because prior to disconnecting it, E4 would be altered and then all the 12 tables (in column A) that feed the charts would update that new asset price and build x-axis price series off it by adding 50 points above and below the mid point value in column A. This would then recalculate 90 columns of date 200 rows deep for 12 charts. Despite the vast number crunching it made no difference to the speed of the output for the option premium in the Y column.
E4 is now no different to E6, E8, E10, to E22.
What is wrong with cell E4’s Asset Price such that when that E4 asset price cell is changed (eg from Dow Jones 40,000 to 45,000) and sent to BSM engine #1 — which is one of the 20 BSM engine tables to calculate option premiums, in the other tab called “20 x BSM engines” — that the result in cell Y4 takes 12, 15, 18 seconds?
This is the only blue cell in the blue bordered Initial Table that causes excessive delays in Y4 output: E4.
All other inputs in Leg 1 like Interest Rate changes or date range changes result in a quick 1 second Y4 update of the new Option Premium in Leg 1 (which reflect the changes made in the blue input cells of this table).
Tests I have carried out and images of the code in the reply to this.
[Edited by Moderator]
MacBook Pro 16″, macOS 14.7