By: Norin
Date: 2007-04-20
Time: 21:07
|
Low performance using sub block.Hi, I am working on a project which takes multiple informations from SQL queries in my database.
With this, I make a big array containing all informations, which I merge into a block. For exemple: Workflow --->Activities --->Steps now, to get my activites for exemple, I do: $gobjTBS->MergeBlock('blkActivites','array','tabLignesWorkflow[%p1%][activitesAffiche]'); [where tabLignesWorkflow is my big array containing everything]. The program works, but it is insanely long to load [almost 1 second by merge...] Could anyone help please? |
|||
By: TomH
Date: 2007-04-20
Time: 21:41
|
Re: Low performance using sub block.Maybe you have already tried TBS header group approach... but I find it works well when working in data that has two or three levels of hierarchy inside a database query.
Like this
Since it does not depend in main/sub query it may be faster for you. There is an example showing several layers deep organized data at my site here http://tomhenry.us/tbs3/myinventory/catalog.php What you see there is three levels: category/vendorid/vendorsku The template looks like this
If this might help please ask for more, TomH |
|||
By: Norin
Date: 2007-04-20
Time: 22:03
|
Re: Low performance using sub block.I think this might be of some help, could you show me how you managed to use this through php?
Thanks |
|||
By: TomH
Date: 2007-04-20
Time: 23:16
|
Re: Low performance using sub block.The query above, is used in the remainder of the php below...
Just notice the "order by" part of the query -- that is the key that matches the sequence of the TBS "headergrp=aaaaa" part of the block definitions. Hope that helps a little, TomH |
|||
By: Norin
Date: 2007-04-25
Time: 20:36
|
Re: Low performance using sub block.I cant use this for my project since I am doing multiple operations on my SQL values... Also, those values comes from many requests :S
|
|||
By: TomH
Date: 2007-04-25
Time: 22:02
|
Re: Low performance using sub block.Sorry, the way that I understood your first post was that you were making one big array from many queries.
In TBS you know you can use an array just like a query result - same thing to TBS. That is why I made the suggestion -- since you could make your array look like whatever you want (like the query result I tried to explain) - you would not have to do the block with sub-query. |
|||
By: Norin
Date: 2007-04-26
Time: 16:00
|
Re: Low performance using sub block.Well I have a big array containing evverything which I do a mergeblock on, but when I am in TBS I cant get the informations contained in my sub-array of this big array...
And this is really weird, I did some timers and found out that my big array was one of the shortest to merge oO while the sub-merges are longer than the big one lol... The best would be to be able to uses the information contained in the sub-arrays of my big array, this way I'd avoid the... 6 seconds required by the sub-merges |
|||
By: TomH
Date: 2007-04-26
Time: 16:18
|
Re: Low performance using sub block.Two ideas...
(1) Think if, while building your array from the queries, you can buils an additional (separate) array that is used insteead of what you called "sub-arrays of my big array" Maybe then you can do multiple Merges
(2) Look at the first example at http://tomhenry.us/tbs3/ this is using an array to do MergeBlock -- page sown the result page to see the print_r of the array. Also shown is source code. This might help some in the template code Hope that helps a little, TomH |
|||
By: Norin
Date: 2007-04-26
Time: 16:34
|
Re: Low performance using sub block.Here is exactly what I do:
it looks like what is on your website but I am using [%p1%] instead of the object[field][field][field] maybe the problem might be from this use? |
|||
By: TomH
Date: 2007-04-26
Time: 17:01
|
Re: Low performance using sub block. ((Sorry if double post))The MergeBlock statements look not expected syntax
Your code
I would have expected...
The [%p1%] in the 'main' merge is not expected (but that is me) I never have seen this syntax in any examples -- maybe TBS doesn;t expect that either When main block firat processes - it has main-block values used by sub merge process -- like this (from example pages)
That's what I see, maybe others here can say more about this syntax. But you can try without the first [%p1%] and test easy enough. Sorry I don't see more. TomH |
|||
By: Norin
Date: 2007-04-26
Time: 17:01
|
Re: Low performance using sub block.I found out that I was doing the same that you are doing in
http://tomhenry.us/tbs3/rss_object_read/highlight_file_TBS_objread_KD_multi.php but Im not using XML files and this is really, really slow... |
|||
By: Norin
Date: 2007-04-26
Time: 17:03
|
Re: Low performance using sub block.my main merge is blkLigneWorkflow, not blkActivites :)
|
|||
By: TomH
Date: 2007-04-26
Time: 22:43
|
Re: Low performance using sub block.Ooops, I get that now.
But my previous point was to try NOT do main/sub merges at all. But to make the correct different arrays that can be used directly. I don't know enough about TBS internals to know why the main/sub your are doing is so slow. Sorry, |
|||
By: Norin
Date: 2007-04-27
Time: 14:39
|
Re: Low performance using sub block.so you mean that I should make new arrays for each sub-arrays in my big array?
I tried to make new arrays for my activities etc but the speed kept being slow :S |
|||
By: Norin
Date: 2007-04-27
Time: 14:57
|
Re: Low performance using sub block.Just to be sure, when I tried to make them I used the [%p1%] after the array so it could go along with the main array...
ex: arrActivity[%p1%] where p1 was equal to the p1 of arrWorkflow[%p1%] |
|||
By: TomH
Date: 2007-04-27
Time: 15:07
|
Re: Low performance using sub block.I meant... to make several arrays at the same time you process the db queries.
I imagined that when you make array you probably looping through query result and building array -- so you can build array for sub-block data when inside the appropriate loop. Maybe that way, instead of one array like...
You get two arrays something like
And then maybe you don;t need [%p%] technique to get sub values from Activities Hope that that's clear |