dourui9570 2014-06-26 01:45
浏览 48

如何提高PHP中大型静态数组的操作性能?

I have a big and complicated static multidimensional array in PHP:

static $data = array (
 'entry1' => array(
'field1' => array(
),
'field2' => array(
)
....
)
...

);

The length of var_export($data, true) is about 2MB.

If I just want to access $array['entry1']['field1'], the first time it takes like ~5 second. I guess the entire array needs to be loaded in memory. Is there any advice how to improve the performance? Should I split this array into smaller arrays?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 gradio的web端页面格式不对的问题
    • ¥15 求大家看看Nonce如何配置
    • ¥15 Matlab怎么求解含参的二重积分?
    • ¥15 苹果手机突然连不上wifi了?
    • ¥15 cgictest.cgi文件无法访问
    • ¥20 删除和修改功能无法调用
    • ¥15 kafka topic 所有分副本数修改
    • ¥15 小程序中fit格式等运动数据文件怎样实现可视化?(包含心率信息))
    • ¥15 如何利用mmdetection3d中的get_flops.py文件计算fcos3d方法的flops?
    • ¥40 串口调试助手打开串口后,keil5的代码就停止了