View Single Post
  #10  
Old 08-12-2006, 06:53 PM
 
geckoday geckoday is offline
 

X-Wizard
  
Join Date: Aug 2005
Posts: 1,073
 

Default

Quote:
Originally Posted by carpeperdiem
Wow, Ralph -- that is some find there!

I just happen to be moving to a new server, and I am benchmarking all kinds of things -- true apples for apples testing... and I am testing virgin installs now -- I have put my store on the shelf until I sort some core stuff out...

Commenting out the "upgraded" 4.0.19 code in /modules/Product_Options/customer_options.php makes a HUGE difference in page load times for pages with options or variants. HUGE. Dramatic difference. Wow.

This is how the code looks in 4.0.18:
Code:
$product_options = func_get_product_classes($productid);

This is what it looks like in 4.0.19:
Code:
$product_options = func_get_product_classes($productid); if (empty($options)) { $min_amount = $product_info['min_amount'] ? $product_info['min_amount'] : 1; $options = func_get_default_options($productid, $min_amount, $user_account['membership']); }

So, to the PHP experts: what exactly is this function doing?
Code:
if (empty($options)) { $min_amount = $product_info['min_amount'] ? $product_info['min_amount'] : 1; $options = func_get_default_options($productid, $min_amount, $user_account['membership']); }

Is it looking for a situation where there is no option selected, and then setting a default option?
Well, customer_options is included into product.php which is what displays the product page in the first place so no options are ever selected. For the life of me I haven't been able to find anything that would ever set that variable before this code is executed. All I can guess is that maybe that variable is used by a module I don't have to set the option to be preselected when the page is displayed. I haven't been able to wrap my mind around func_get_default_options yet and what its all about. It used by cart.php and wishlist too I believe. Exactly what for I don't know yet.

Quote:
I went through the changelog for .19 and there are a few references to "product options" -- but I think this code is the long way around to solve a very special problem... please correct me if I'm wrong...
Quote:
Wed Mar 15 11:38:28 MSK 2006 [!] - max - Bug: If all the products in the store that belonged to a certain product class did not have product class option values, and some of these products were added to a comparison chart, displaying the Product features chart page caused a PHP error when these products were deleted from the chart. Fixed.
Seems like for my store, where all but a few items have product options, and all of the options are single color variants as pull-down menus, this code is just a drag for me -- Ralph, does this sound right to you? Other PHP experts?
Hard to say. I'm guessing not.

Quote:
I wonder how many sub-routines there are that are the long way around, simply to solve a rare problem, but for 99% of the users, there is no need to do this... and B-L-O-A-T starts creeping in... and the codebase needs a rewrite -- oh, they did this in 4.1
There are lots of places with bloat. The whole product/variant world screams for a much better object-oriented approach where virtually the same queries don't get reexecuted several times when displaying a page. I'm not sure how much optimization was done in 4.1.
Quote:
Man, how I wish 4.1 was ready for prime time. I am using too many cool mods though... so 4.0.x is going to be it for the time being...

I have commented out this code from .19 -- if someone can think of a reason why I might want to keep it live, PLEASE, PLEASE speak up.

Thanks Ralph!!!!


Jeremy
Thanks for sharing your experience Jeremy. I would have blindly installed 4.0.19 and never seen the performance issue in testing and probably not until my holiday peak season when it could cost me a lot of money.
__________________
Manuka Bay Company
X-Cart Version 4.0.19 [Linux]

UGG Boots and other fine sheepskin products
http://www.snowriver.com
Reply With Quote