Home Community Mys-Script Creative Off-Topic |
|
|
Thread Tools | Display Modes |
#1
|
||||
|
||||
Optimizing Profiles and Daycare
Hello!
I've noticed that the daycare and user profiles (anywhere where a large amount of pets must be loaded) seems to load extremely slowly on my site. The host itself may be to blame, but it's difficult for me to tell in that regard. Does anyone possible have some ideas to optimize these features so that they load more quickly? Right now I have the daycare modified to only show 25 pets, and then needs to be reloaded to show more (so no pages), and profiles display pet groups (so not all at once).
__________________
My Mods Site (1.3.4, 2020 Mods) |
#2
|
||||
|
||||
Well, I have a couple suggestions that may or may not help much.
Probably the easiest way to potentially speed up the pages may be to add suitable indexes to your mysql tables. You can do that from phpmyadmin, going to structure then clicking to add an index on the column. My index suggestions would be to add an index on the columns in the following tables: owned_adoptables table - owner, type, possibly currentlevel adoptables table - type levels table - adoptiename, thisislevel These are the columns that the daycare uses to select pet information. If your tables are small, indexes won't help. Also, indexes can slow inserts so don't add too many. You should also optimize your images as much as you can. I also wrote a few new functions for the daycare. The daycare code calls the database multiple times per pet displayed, so I used joins to combine the individual calls into one big call for the whole result set. This mostly helps avoid latency. The custom functions also bypass some of the classes since many of the constructors call the database and for ease of use I didn't want to modify more than two files. Also didn't want to directly replace methods, so the result is slight code duplication but this way it can't interfere with anything else on the site. Anyway, add these three methods to the bottom of your class_daycare.php file, under the getStats method. PHP Code:
PHP Code:
|
#3
|
||||
|
||||
Well, the daycare loading speed is vastly improved! Absolutely brilliant, thank you so very much! Damned thing was driving me crazy!
I'm still looking over the profiles and seeing what I can do there, haha.
__________________
My Mods Site (1.3.4, 2020 Mods) |
|
|
What's New? |
What's Hot? |
What's Popular? |