Issue 50263

Summary: setDataArray on large arrays completely locks OOo and windows
Product: Calc Reporter: marinus <mpmoelker>
Component: programmingAssignee: AOO issues mailing list <issues>
Status: CONFIRMED --- QA Contact:
Severity: Trivial    
Priority: P3 CC: issues
Version: recent-trunk   
Target Milestone: ---   
Hardware: PC   
OS: All   
Issue Type: DEFECT Latest Confirmation in: ---
Developer Difficulty: ---
Attachments:
Description Flags
Spreadsheet with get/setDataArray macro example none

Description marinus 2005-06-03 02:52:55 UTC
Sirs,

setDataArray and getDataArray on large arrays lock not only OOo but effectively
shuts down Windows XP.
Trying to access the Windows XP taskmanager takes about 30 seconds on a P4 2800
with 256 MB.

This simple basic demonstrates what happens when trying to get/set with
setDataArray pointing to a whole Calc sheet.

Somehow it would be useful, if this in inherent to this function, to have some
sort of API protection when trying to access such large arrays.

Sample code:

sub Main
   oDoc = ThisComponent
   oSheets = oDoc.getSheets()

   oSheet1 = oSheets.getByName("Sheet1")
   oSheet2 = oSheets.getByName("Sheet2")

   ' If you want the whole sheet just set (in OOo 2.0)..
   
   nColumn = 1

   nTimer1 = Timer()
   'for nRow = 1 to 65536
   '   if nRow / 256 = nColumn then nColumn = nColumn + 1
   '   if nColumn > 256 then exit for
   '   oCell = oSheet1.getCellByPosition(nColumn - 1, nRow - 1).setValue(nRow)
   'next
   nTimer2 = Timer()
   
   ' 0 seconds
   sCellRangeName = "A1:IV10"
   ' 2 seconds on P4 2800
   sCellRangeName = "A1:IV1000"
   ' 19 seconds on P4 2800
   sCellRangeName = "A1:IV10000"
   ' kills it
   ' sCellRangeName = "A1:IV65536"
  
   oCopyCellRange = oSheet1.getCellRangeByName(sCellRangeName)
   
   oPasteCellRange = oSheet2.getCellRangeByName(sCellRangeName)
   
   
   ' and copy/paste all cells 
   oPasteCellRange.setDataArray(oCopyCellRange.getDataArray)
   nTimer3 = Timer()




   'assuming midnight not passed
   nTotalWriteSeconds = nTimer2 - nTimer1
   nWriteMinutes = Fix(nTotalWriteSeconds / 60)
   nWriteSecondsLeft = nTotalWriteSeconds - nWriteMinutes * 60
   
   nTotalCopyPasteSeconds = nTimer3 - nTimer2
   nCopyPasteMinutes = Fix(nTotalCopyPasteSeconds / 60)
   nCopyPasteSecondsLeft = nTotalCopyPasteSeconds - nCopyPasteMinutes * 60

   nTotalSeconds = nTimer3 - nTimer1
   nTotalMinutes = Fix(nTotalSeconds / 60)
   nTotalSecondsLeft = nTotalSeconds - nTotalMinutes * 60

   sWrite = "Writing took " + nWriteMinutes + " minutes and " +
nWriteSecondsLeft + " seconds."
   sCopy = "Copy/paste took " + nCopyPasteMinutes + " minutes and " +
nCopyPasteSecondsLeft + " seconds."
   sTotal = "Total operation took " + nTotalMinutes + " minutes and " +
nTotalSecondsLeft + " seconds."
   msgbox sWrite + Chr(13) + sCopy + Chr(13) + sTotal
   
end sub

Sample spreadsheet with macro attached.

Hope this helps,

Marinus.
Comment 1 marinus 2005-06-03 02:53:54 UTC
Created attachment 26843 [details]
Spreadsheet with get/setDataArray macro example
Comment 2 frank 2005-06-15 14:59:15 UTC
Hi Sascha,

please have a look at this one, set target accordingly or close. Seems to be a
performance problem.

IMHO this isn't a real used case because copying a whole filled sheet isn't a
real world thing.

Frank
Comment 3 frank 2005-06-22 12:04:48 UTC
targeted OOo later
Comment 4 m_ono_m 2005-07-13 19:40:22 UTC
Hi,

This is REAL and very important problem, I think.

OOo 2.0, Calc can handle 65536 rows and this is a big feature.
But we can't use large data because of this bug.
This is REAL problem.


I write Java add-on program.
And I found same problem ...
My program takes 120 seconds for a case of action that
MS Excel VBA can finish in 10 seconds.

I hope everyone think this important.

thanks,

Makoto Ono (Japan)
Comment 5 Rob Weir 2013-07-30 02:17:40 UTC
Reset assignee on issues not touched by assignee in more than 2000 days.