doufu8588 2014-04-26 10:52
浏览 147
已采纳

如何在PHP中处理大量数据

I'm currently creating a calculator for a client that has a set of options which all feed into an algorithm which throws out a few figures. The algorithm is coded in PHP and jQuery feeds in the selected options through it's ajax method.

It's better to show than tell so here it is:

http://clients.benpalmer.me/the-eco-experts/solar-calulator/

The calculator currently works out the new figures once an option is selected (but not during). Basically, I'm wanting if possible to use real time calculations so when you slide a percentage slider for example - the figures update as you're sliding (not after).

This is set up with a mysql database which has 8760 rows of data and each row is needed to figure the final figures. As you can probably imagine - this isn't particularly fast.

I'm trying to work out a faster method of figuring this out (I'm not sure if there actually is a faster method).

So far I've thought about putting all of this data in to an array instead on the off-chance that it would be faster. After testing this out - it seems to work at the same sort of speed (probably a bit slower). I've also tried to use the SplFixedArray class in PHP but again, with so much data - there is no discernible improvement in performance.

Unfortunately, I haven't been able to find any other method and I suspect that I'm fighting a losing battle with this one but any suggestions would be greatly appreciated.

  • 写回答

2条回答 默认 最新

  • duandeng7132 2014-04-28 12:36
    关注

    In the end, I was able to calculate the figures that I needed on the fly with PHP. It involved a HUGE loop but it's helped drastically with the speed.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么