?
说明: 这个历史遗留的页游的技术架构存在问题,并且当时总是说要上线,修改时间也很有限,下面是我当时对其稍微过问一下之后,所能提出的相当有限的技术优化改进的一些comment.
但是毕竟, 这个页游总是被管理层要求即将上线,然后在很有限的时间内永远只能做有限的小修小补,总是不能彻底解决问题,结果是这个页游永远上不了线……? 不懂技术,只是从市场营销的角度来片面要求的管理层来管理就是这样的结果…… ?2012-02-17 wooce?9:54:03? lib/itemconfig.php?和??lib/missionconfig.php,?大小都至少几乎1.5M以上,?并且里面记录的实际上是数据......?? 这样引用它们的程序,?每次执行时都要装载它们估计都要花掉不少时间...... php-黄* 9:59:26? 嗯,每个连接都耗几M内存 wooce?10:01:34? 我对这点的优化想法是:?把lib/itemconfig.php?和??lib/missionconfig.php转成用csv格式来存储,?然后装载进去memcache里去,?以后每次php执行时,?如果有要用到它们的数据的地方,?就只要从memcache中读取就可以了 wooce?10:05:11? 那么要优化这点,?首先是把lib/itemconfig.php?和??lib/missionconfig.php转成用csv格式,?如果用手工编辑一个个修改到csv的话很笨拙很繁琐,??可以另外写一个简单的php程序,里面引用lib/itemconfig.php?和??lib/missionconfig.php,?然后程序里循环自动写入到csv里去。??有了csv后,?再搞读取csv到memcache里的程序。 这两步我想让耀*来做,?有没问题呢? php-黄* 10:05:37? 在数据库有的 wooce?10:08:00? 有??哪张表? php-黄* 10:08:20? game_item_info php-黄* 10:08:28? game_mission_info php-黄* 10:08:47? 所有这些配置都是数据库生成的 wooce?10:39:53? 那么,?game_item_info表是通过GMTool维护的??itemconfig.php也是在GMtool维护的时候同时生成的? php-黄* 10:54:15? itemconfig.php也是通过www/csv/import_csv.php生成的 wooce?10:55:25? 明白了,?其实最初是有csv,?然后数据库里的和itemconfig.php都是通过csv导入生成的 php-黄* 10:55:49? www/csv/import_csv.php导入csv文件 wooce?10:57:21? 嗯,找到了,?csv目录下有game_item_info.csv wooce?11:13:35? 那么,?只需要把现成的csv读入memcache,?然后加上从memcache读取item和mission的config?的代码就可以了 wooce?11:28:15? 这个优化工作?耀*还是黄*来做呢? PHP-梁耀* 11:59:18? wooce 11:13:35? 那么,?只需要把现成的csv读入memcache,?然后加上从memcache读取item和mission的config?的代码就可以了 这两个文件的数据平常是不变的吗? php-黄* 12:01:41? 有可能变化?的 php-黄* 12:02:13? 策划那边有时有改动 wooce?13:41:17? 嗯,?要能在必要时reload?memcache中的数据 php-黄* 13:43:39? 可以直接将配置中的数组存入Memcached PHP-梁耀* 14:00:33? 那这部分的优化,我去做吧 wooce 11:12:32?
哦, 那么$item 大约有多大呢
php-黄* 11:14:51?
case 'create':{
的注释有item的说明
php-黄* 11:29:43?
现在涉及itemconfig的文件很多的
php-黄* 11:29:59?
新功能还没做完呢
wooce 11:30:49?
这个算是小的优化了, 如果这个都做不了, 那现有版本可优化的地方就没多少了
php-黄* 11:31:27?
嗯
|
对一个php开发的页游的一些技术优化的comment
Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

APHPDependencyInjectionContainerisatoolthatmanagesclassdependencies,enhancingcodemodularity,testability,andmaintainability.Itactsasacentralhubforcreatingandinjectingdependencies,thusreducingtightcouplingandeasingunittesting.

Select DependencyInjection (DI) for large applications, ServiceLocator is suitable for small projects or prototypes. 1) DI improves the testability and modularity of the code through constructor injection. 2) ServiceLocator obtains services through center registration, which is convenient but may lead to an increase in code coupling.

PHPapplicationscanbeoptimizedforspeedandefficiencyby:1)enablingopcacheinphp.ini,2)usingpreparedstatementswithPDOfordatabasequeries,3)replacingloopswitharray_filterandarray_mapfordataprocessing,4)configuringNginxasareverseproxy,5)implementingcachingwi

PHPemailvalidationinvolvesthreesteps:1)Formatvalidationusingregularexpressionstochecktheemailformat;2)DNSvalidationtoensurethedomainhasavalidMXrecord;3)SMTPvalidation,themostthoroughmethod,whichchecksifthemailboxexistsbyconnectingtotheSMTPserver.Impl

TomakePHPapplicationsfaster,followthesesteps:1)UseOpcodeCachinglikeOPcachetostoreprecompiledscriptbytecode.2)MinimizeDatabaseQueriesbyusingquerycachingandefficientindexing.3)LeveragePHP7 Featuresforbettercodeefficiency.4)ImplementCachingStrategiessuc

ToimprovePHPapplicationspeed,followthesesteps:1)EnableopcodecachingwithAPCutoreducescriptexecutiontime.2)ImplementdatabasequerycachingusingPDOtominimizedatabasehits.3)UseHTTP/2tomultiplexrequestsandreduceconnectionoverhead.4)Limitsessionusagebyclosin

Dependency injection (DI) significantly improves the testability of PHP code by explicitly transitive dependencies. 1) DI decoupling classes and specific implementations make testing and maintenance more flexible. 2) Among the three types, the constructor injects explicit expression dependencies to keep the state consistent. 3) Use DI containers to manage complex dependencies to improve code quality and development efficiency.

DatabasequeryoptimizationinPHPinvolvesseveralstrategiestoenhanceperformance.1)Selectonlynecessarycolumnstoreducedatatransfer.2)Useindexingtospeedupdataretrieval.3)Implementquerycachingtostoreresultsoffrequentqueries.4)Utilizepreparedstatementsforeffi


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article
Roblox: Grow A Garden - Complete Mutation Guide
3 weeks agoByDDD
Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
How to fix KB5055612 fails to install in Windows 10?
3 weeks agoByDDD
Nordhold: Fusion System, Explained
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SublimeText3 Linux new version
SublimeText3 Linux latest version

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.
