dqwh1218 2013-04-23 20:27
浏览 50


I have a rather complex spreadsheet formula. Right now I am using PHPExcel to load the spreadsheet into memory, and I set the cell values of the formula input to the values from a front-end form (using ajax), get the calculated result and send it back to the client.

Is this the best way to this? Or should the formulas be converted to pure php?

If this is an okay method, I have concerns regarding concurrency and memory usage.

The spreadsheet isn't that large, less than 1000 cells. How can I calculate the threshold for concurrency (people clicking calculate on the front end) and memory usage on the server?

What steps can I take to optimise this algorithm (caching for example) whilst balancing performance?

  • 写回答

1条回答 默认 最新

  • douren2395 2013-04-23 20:40

    You're going to have problems doing this as an ajax request for large numbers of concurrent users, because these http requests have no persistence, so you need to load the spreadsheet file for every request. What it does guarantee is that each request runs independently with its own copy of the spreadsheet, so no individual user's request will affect any of the other users requests.

    The other extreme is to take all the Excel logic and rewrite it in PHP. You don't give any indication of the complexity of your spreadsheet formulae, so it's difficult to judge how complex a task this would be.

    A third option would be to use only PHPExcel's calculation engine, feeding it with the form values and formulae directly. This eliminates the time and memory overheads of loading the spreadsheet file with every request, so could be the easiest and most efficient option. You can find an example of this in the Quadratic2.php example file in the /Tests directory of the PHP distribution.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?



  • ¥15 ogg dd trandata 报错
  • ¥15 高缺失率数据如何选择填充方式
  • ¥50 potsgresql15备份问题
  • ¥15 Mac系统vs code使用phpstudy如何配置debug来调试php
  • ¥15 目前主流的音乐软件,像网易云音乐,QQ音乐他们的前端和后台部分是用的什么技术实现的?求解!
  • ¥60 pb数据库修改与连接
  • ¥15 spss统计中二分类变量和有序变量的相关性分析可以用kendall相关分析吗?
  • ¥15 拟通过pc下指令到安卓系统,如果追求响应速度,尽可能无延迟,是不是用安卓模拟器会优于实体的安卓手机?如果是,可以快多少毫秒?
  • ¥20 神经网络Sequential name=sequential, built=False
  • ¥16 Qphython 用xlrd读取excel报错