• You are not logged in. | Login

Post a reply

February 27, 2007 10:09 am

Mr.SMart
Member
Ranks

Transmitting a big massive

There is class A one of which features is a big massive. Class A periodically calls function C from class B (copy of class B is created within A in constructor). This big massive is transmitted to the given function (it doesn’t return the massive so we don’t need any changes within the massive). By transmitting parameters through a link not the data themselves but a link to storage area is transmitted. Can I save memory if I transmit this massive through a link?


 

 

February 27, 2007 10:11 am

Re: Transmitting a big massive

It depends on what this function does with a massive. By the way, if the massive is so big that it’s critical for memory to create its copy and we talk about web… I advice you to find a way to evade its downloading into script.


 

 

February 27, 2007 10:16 am

Mr.SMart
Member
Ranks

Re: Transmitting a big massive

It’s a massive with lengths. First function searches for necessary correspondence in this rather big length massive and then returns correspondences found. It’s not so big to be critical for memory but this operation is repeated several times within script and so it is desirable to optimize this process.

P.S. Am I right concerning parameters’ transmission through a link?

Last edited by Mr.SMart (February 27, 2007 10:17 am)


 

 

February 27, 2007 10:19 am

monkeydude
Member
Ranks

Re: Transmitting a big massive

Sure, we shouldn’t make a pair of copies.


 

 

February 27, 2007 10:22 am

Keeper
Member
Ranks

Re: Transmitting a big massive

Mr.SMart, it’s already transmitted ‘through a link’… Don’t think about such questions without necessity


 

 

February 27, 2007 10:24 am

Re: Transmitting a big massive

Mr.SMart, it’s not the thing I’ve asked about but it doesn’t matter.
On one hand COW. copy is created by means of variable’s modification only (at this by massive’s modification only the massive itself is copied; no copies are created for elements).

On the other hand it is massive’s modification including manipulations with its inner indicator i.e. foreach, each, next, etc. unlike, for instance, excess with classic cycle for.

And finally the matter of links is not good and so you are to evade their usage without necessity; cycle for isn’t illustrative. You should optimize when some part of a code functions wrong…


 

 

February 27, 2007 10:27 am

Mr.SMart
Member
Ranks

Re: Transmitting a big massive

I handle massive by means of for. Everything seems to function properly now as far as massive is small but it’s possible that it’ll be out of order when working with a big massive.

Where can I read about it?


 

 

February 27, 2007 10:30 am

Re: Transmitting a big massive

Everything seems to function properly

Then you shouldn’t think about it. At all. And you don’t need for.
Or do you believe that you are able to define for sure that part of a code which is likely to cause problems in the future? (And if you suffer from nightmares – could you possibly create a massive of supposed size and check it?)
The only thing you should evade is pessimism. As for me, I’m not sure succession of massive is needed at all.

Where can I read about it?

It’s difficult to find detailed information concerning the problem. But you still may find something concerning COW + php in Google.


 

 
  • Actions
  • Top
ITCrimea. Ukraine Web Development Company. Professional Developers and Web Designers Team
Custom Web Designs, Internet Applications, E-Commerce Websites, Interactive Sites, Database-Driven Sites and Services