ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Are objects slow in VBA? (https://www.excelbanter.com/excel-programming/396480-objects-slow-vba.html)

Charles

Are objects slow in VBA?
 
Hello

I just have a general question: in your opinion, are objects in VBA
slower than using directly arrays and subs? I mean you necessarily
have a few more declarations to do, etc in the object. But that aside,
does the management of objects by VBA significantly reduces the speed
of execution of the code?

I have made a try, and I am a bit disappointed by the exec time. Could
be my fault, but just asking in case...

thanks!
Charles


Jim Thomlinson

Are objects slow in VBA?
 
In my experience object ore not distinctly slower than regular procedural
programming. As you say they do come with a bit more overhead but not enough
to cause great concern...
--
HTH...

Jim Thomlinson


"Charles" wrote:

Hello

I just have a general question: in your opinion, are objects in VBA
slower than using directly arrays and subs? I mean you necessarily
have a few more declarations to do, etc in the object. But that aside,
does the management of objects by VBA significantly reduces the speed
of execution of the code?

I have made a try, and I am a bit disappointed by the exec time. Could
be my fault, but just asking in case...

thanks!
Charles



kassie

Are objects slow in VBA?
 
Maybe if you post your code, someone will be able to assist? VBA is not slow
though
--
Hth

Kassie Kasselman
Change xxx to hotmail


"Charles" wrote:

Hello

I just have a general question: in your opinion, are objects in VBA
slower than using directly arrays and subs? I mean you necessarily
have a few more declarations to do, etc in the object. But that aside,
does the management of objects by VBA significantly reduces the speed
of execution of the code?

I have made a try, and I am a bit disappointed by the exec time. Could
be my fault, but just asking in case...

thanks!
Charles



Jon Peltier

Are objects slow in VBA?
 
It depends what you mean by object. If you mean manipulating a range one
cell at a time, yes, this might be obviously slower than manipulating the
entire range at once, or than getting the values into VBA, doing
calculations, and dumping the results back into the sheet.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"Charles" wrote in message
oups.com...
Hello

I just have a general question: in your opinion, are objects in VBA
slower than using directly arrays and subs? I mean you necessarily
have a few more declarations to do, etc in the object. But that aside,
does the management of objects by VBA significantly reduces the speed
of execution of the code?

I have made a try, and I am a bit disappointed by the exec time. Could
be my fault, but just asking in case...

thanks!
Charles




Charles

Are objects slow in VBA?
 
Sorry, I didn't mean Excel object. I understood the Excel-VBA link is
extremely slow. I was thinking to VBA-defined objects (using "class").
I left everything on option explicit, "long" used for integers. I
think that I must simply do an unecessary number of loops.

Also, I am building a model aimed to do monte carlo simulations. So I
was looking at how long it took to run 10,000 times the model (which
implies about 50 arrays of dim ~40*1, and some loops to populate/
aggregate them). I guess that with that sort of dimensions, I can't
expect it to take less than a minute.

Charles


Jon Peltier

Are objects slow in VBA?
 
I've always felt that working within VBA was *not* the rate limiting part of
most of my applications, even the intensive data manipulation ones. But 10k
simulations requiring that many arrays of that size should be expected to
take more than a couple seconds.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"Charles" wrote in message
ps.com...
Sorry, I didn't mean Excel object. I understood the Excel-VBA link is
extremely slow. I was thinking to VBA-defined objects (using "class").
I left everything on option explicit, "long" used for integers. I
think that I must simply do an unecessary number of loops.

Also, I am building a model aimed to do monte carlo simulations. So I
was looking at how long it took to run 10,000 times the model (which
implies about 50 arrays of dim ~40*1, and some loops to populate/
aggregate them). I guess that with that sort of dimensions, I can't
expect it to take less than a minute.

Charles





All times are GMT +1. The time now is 03:15 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com