Excel-DNA / Excel-DNA/ExcelDna

RTD hang excel with "many" Observe-type UDFs

Open
#748 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
C#
Stars
1.5k
Forks
292
Avg merge
20d 12h
Merged PRs (30d)
1

Description

I have an addin (VSTO + ExcelDNA for UDF components) I am writing that uses the following pattern for a formula:

- `ExcelAsyncUtil.Observe(...)` to set up an observable
- Push `#GETTING_DATA` initially (which seems to be moderately quick)
- Aggregate formula requests into API calls
- On receiving responses from the API, push the values back to the cells
- Actual push to observables that are linked to each cell takes place on a background task

This works very well for moderate numbers of formulae (let's say, less than 50k). However, if computing a large workbook with 260k formula calls involved, something odd happens - the workbook hangs whenever I push large chunks of numbers to their respective observables.

Currently the solution I'm using is to introduce some delay between batches of pushes + detect user input and suspend pushes to my observables for a chunk of time when it's detected. The upshot is Excel is "hangy" (but not dead to input) until a user gets a click in edgewise, and then they gain control moderately quickly until they leave things sitting for 15 seconds or so.

What I'm wondering is if this is something that could better sit in a configuration passed to the `Observe(...)` call to provide some mechanism for deciding how much RTD data to publish and when to hold off? Or if there's anything I could be doing differently that would avoid the hanging entirely, in an ideal world.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.