Re: Enlighten me - Mac vs. PC processing speeds



On Feb 25, 9:02 pm, Jim Gordon MVP <goldke...@xxxxxxxxxxxxxxxxxxxxxx>
wrote:
c1802...@xxxxxxx wrote:
Can anyone enlighten me on the fundamental difference why the same VBA
code runs at such different speeds on Macs vs. PCs?

Here's an example. I wrote some code months ago on my PC at work (Dell
1.73GHz/504 mB RAM/Windows XP). The task involved transposing 4000+
data records from a columnar listing to a tabulated format. The source
data was comprised of column A which listed the label name of each
field in the record. Column B carried the corresponding data for each
field. Between each record there was a blank cell, so each record's
field labels were repeated in column A. The only other nuance was that
each record did not carry the same number of fields, so I had to code
the macro to read to the end of each record in column B before copying
and transposing it to the table. I accomplished this by creating a
loop that read the data in each field into an array until it reached a
blank cell, then created another loop to write out the array to the
table. On the PC it took about 2 minutes 30 seconds to complete the
task.

I took the code home to run the same file on my Mac (iMac G5 1.8 GHz/
1GB RAM/OS X 10.5). It took more than 8 hours to run the same code!

A few weeks ago, I recoded the macro to make the task more efficient.
This time around I used 'Range(ActiveCell,
ActiveCell.End(xlDown)).Select' to grab the entire record at once
before transposing it to the table. Now the PC version runs in under 3
seconds. The Mac takes 2 minutes and 20 seconds.

Can someone explain what is inherent in the Mac that doesn't allow it
to process code as fast as the PC?

Art

Hi Art,

If you go into the Visual Basic Editor (VBE) and step through the code
by pressing F8, are is there a particular command or operation that
takes a long time to execute?

If so, can you post the offending code snippet here? Sometimes people
know alternative methods that can be faster and they can post their
suggestions in the newsgroup.

-Jim

--
Jim Gordon
Mac MVP

MVPs are independent experts who are not affiliated with Microsoft.http://mvp.support.microsoft.com/

Jim,

Yes, I've done the step through, including using the watch window, and
putting msgbox pop ups where appropriate (that's generally how I
confirm my code is doing what I want)

there was nothing that was obvious to me. If you want, I'll post the
code tomorrow after I bring it home from work,

Art
.



Relevant Pages

  • Re: Enlighten me - Mac vs. PC processing speeds
    ... The task involved transposing 4000+ ... then created another loop to write out the array to the ... I took the code home to run the same file on my Mac (iMac G5 1.8 GHz/ ...
    (microsoft.public.mac.office.excel)
  • Enlighten me - Mac vs. PC processing speeds
    ... The task involved transposing 4000+ ... then created another loop to write out the array to the ... I took the code home to run the same file on my Mac (iMac G5 1.8 GHz/ ...
    (microsoft.public.mac.office.excel)
  • Re: Transpose
    ... Dim myA As Range ... Now it's time for transposing. ... In the next loop I will need add another 9 rows and the contents of A12 to ...
    (microsoft.public.excel.programming)
  • Re: Transpose
    ... transposing yet) ... I am copying data from one workbook to another. ... In the next loop I will need add another 9 rows and the contents of A12 to ... In a Macro I am transferring data from one worksheet to another. ...
    (microsoft.public.excel.programming)
  • Re: Numpy and cPickle
    ... If I cPickle a numpy array under Linux and un-cPickle it under Solaris ... script runs on and then transposing the array? ... differently-endianed platforms that was fixed in the past few days. ...
    (comp.lang.python)