You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've used your lib to write a simple util that takes paths to images from one column, creates a thumbnail and pastes it to another column via AddPictureFromBytes.
Everything worked fine but I've noticed that for files with thousands of rows every next insertion took exponentially longer time.
For example, files with from 0 to 1k of rows are processed nearly instantly, 5-10k takes several minutes, >10k can take up to an hour.
I've found a problem, made a fork and used it so now it takes linear time to insert images anywhere.
Please consider if it can be useful for someone else.
The fix is pretty simple (in fact I've just deleted some of unused code): a1tus@2bbe157
positionObjectPixels calculates yAbs via cycle from 0 to the current row and summing getRowHeight results. getRowHeight by itself have an identical cycle inside (not sure why it's written like that instead of accessing SheetData.row[i] directly). So that's where we get these exponential time grow.
But the most fun fact (and also why the fix is so simple) is that xAbs/yAbs results of positionObjectPixels is not used anywhere! If you think that it's still needed then we can add bool param to skip these calculations for some particular cases.
The text was updated successfully, but these errors were encountered:
Hello.
I've used your lib to write a simple util that takes paths to images from one column, creates a thumbnail and pastes it to another column via
AddPictureFromBytes
.Everything worked fine but I've noticed that for files with thousands of rows every next insertion took exponentially longer time.
For example, files with from 0 to 1k of rows are processed nearly instantly, 5-10k takes several minutes, >10k can take up to an hour.
I've found a problem, made a fork and used it so now it takes linear time to insert images anywhere.
Please consider if it can be useful for someone else.
The fix is pretty simple (in fact I've just deleted some of unused code): a1tus@2bbe157
positionObjectPixels
calculatesyAbs
via cycle from 0 to the current row and summinggetRowHeight
results.getRowHeight
by itself have an identical cycle inside (not sure why it's written like that instead of accessingSheetData.row[i]
directly). So that's where we get these exponential time grow.But the most fun fact (and also why the fix is so simple) is that
xAbs/yAbs
results ofpositionObjectPixels
is not used anywhere! If you think that it's still needed then we can add bool param to skip these calculations for some particular cases.The text was updated successfully, but these errors were encountered: