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条)

报告相同问题?

悬赏问题

  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 Revit2020下载问题
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大
  • ¥15 单片机无法进入HAL_TIM_PWM_PulseFinishedCallback回调函数
  • ¥15 Oracle中如何从clob类型截取特定字符串后面的字符
  • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
  • ¥15 如何在炒股软件中,爬到我想看的日k线
  • ¥15 seatunnel 怎么配置Elasticsearch