dpjo15650 2014-03-12 10:49
浏览 24

3级菜单中的PHP MySql速度优化

I have a nicely working 3 level menu with a HUGE amount of sub-menu points. In the current test version all menu info is read from arrays in PHP and converted into $_GET parameters added to the link of a single display page. On this page the parameters submitted with $_GET are evaluated for the DB Query and the matching content will be displayed.

In order to make the content (including the corresponding menu items) modifyable by the customer, I have to move the menu structure to the database.

Now my question is:

Which is better:

a) On every update of the DB rewrite the file with menu data arrays and keep the menu as it is.

b) Generate temporary arrays of everyxthing when when the menu is displayed

c) generate the submenues only when the higher level is selected

Version a) has proven to have an acceptable page loading for end users (tested with a dummy database online) but not sure about Google ranking (depends much on page loading time). I'm not sure which is faster, reading the menu structure arrays with a MySql Query(version b) or from a file (version a). Data transmitted would be the same, so no difference in loading that.

c) has the advantage of transmitting less data in the beginning, so it would be def faster but would have to reload the page every time the end user selects a menu item. That would produce an annoying delay, which end users are usually not happy about.

Versios b) and c) would produce a lot of DB queries though, which could be avoided with version a)

So if you have experience with speed optimization - all opinions, comments and suggestions are welcome.

Thank you, Tina

  • 写回答

1条回答 默认 最新

  • dongqian5569 2014-03-12 10:57
    关注

    Menu is such a trifle matter that doesn't affect performance at all. Neither for database interaction, nor for amount of data transmitted.

    If it's indeed a menu (Not some sort ot nested catalog with 10K+ positions) - just read all the content from database and write all at once.

    评论

报告相同问题?

悬赏问题

  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100