1、外文翻译PERFORMANCECOMPARISONOFPHPANDJSPASSERVERSIDESCRIPTINGLANGUAGESMATERIALSOURCENOTESINCOMPUTERSCIENCEAUTHORSCOTTTRENTMICHIAKITATSUBORITOYOTAROSUZUMURAAKIHIKOTOZAWAANDTAMIYAONODERAABSTRACTTHEDYNAMICSCRIPTINGLANGUAGEPHPHASBECOMEENORMOUSLYPOPULARFORIMPLEMENTINGLIGHTWEIGHTWEBAPPLICATIONS,ANDISWIDELYUSE
2、DASASERVERSIDESCRIPTINGLANGUAGEFORWEBSERVERSTOCONTRASTTHEPERFORMANCEOFPHPANDJSPFORTHISPURPOSE,WEUSEDTHESPECWEB2005BENCHMARK,WHICHPROVIDESTHREEAPPLICATIONSCENARIOSIMPLEMENTEDINBOTHPHPANDJSPTHISPAPERDESCRIBESANDCONTRASTSTHERESULTSOFSPECWEB2005PERFORMANCEBENCHMARKTESTINGPERFORMEDONDIFFERENTCONFIGURATIO
3、NSOFPHPANDJSPUSINGTHEPOPULARWEBSERVERSAPACHEANDLIGHTTPDDESPITETHEEXECUTIONOVERHEADOFINTERPRETATIONINPHPENGINESOBSERVEDINMICROBENCHMARKS,THEEXPERIMENTALRESULTOFSPECWEB2005BENCHMARKYIELDSVALUABLEPERFORMANCEDATAFORWEBSERVERIMPLEMENTERSTHEEFFICIENCYOFSCRIPTINGLANGUAGERUNTIMESSTILLMATTERSFORTHEENDTOENDPE
4、RFORMANCEHOWEVER,ONCECAREFULLYARCHITECTEDANDTUNED,THELANGUAGERUNTIMEISLESSOFABOTTLENECKTHANTHEWEBSERVERPERFORMANCEITSELFKEYWORDSPHP,JSP,SPECWEB,BENCHMARKING,WEBSERVER1INTRODUCTIONTHEDYNAMICSCRIPTINGLANGUAGEPHPPHPHYPERTEXTPREPROCESSORHASBECOMEENORMOUSLYPOPULARFORIMPLEMENTINGLIGHTWEIGHTWEBAPPLICATIONS
5、,ANDISWIDELYUSEDTOACCESSDATABASESANDOTHERMIDDLEWAREAPACHEMODULEPOPULARITYSURVEYSPERFORMEDBYSECURITYSPACEINOCTOBER2007INDICATETHAT37OFAPACHESERVERSHAVEPHPSUPPORTENABLED,MAKINGITTHEMOSTPOPULARAPACHEMODULEBY10PERCENTAGEPOINTSBUSINESSESAREQUICKLYREALIZINGTHEPOWERFULCOMBINATIONOFASERVICEORIENTEDARCHITECT
6、UREENVIRONMENTWITHDYNAMICSCRIPTINGLANGUAGESLIKEPHPHOWEVER,WEBELIEVETHATTHEREARESTILLCRITICALPERFORMANCEISSUESINVOLVINGPHPWHICHREMAINTOBEINVESTIGATEDTHISPAPERFOCUSESONTHEUSEOFDYNAMICSCRIPTINGLANGUAGESTOIMPLEMENTWEBSERVERFRONTENDINTERFACESTHISCORRESPONDSWITHTHEWAYTHATTHEINDUSTRYSTANDARDWEBSERVERPERFOR
7、MANCEBENCHMARKSPECWEB2005UTILIZESPHPANDJSPJAVASERVERPAGESINTHISCASE,SCRIPTSAREUSEDFORTHEIMPLEMENTATIONOFDYNAMICPAGEGENERATION,RATHERTHANTHEREALIZATIONOFCOMPLEXBUSINESSLOGICTHISCONTRASTSWITHTHETRADITIONALUSESOFCOMPLEXJSPBASEDBUSINESSLOGICIMPLEMENTATIONWHILETHEREARENUMEROUSSTUDIESONDYNAMICWEBCONTENT,T
8、HISPAPERCOMPLEMENTSTHESESTUDIESWITHDETAILEDANALYSISFOCUSINGONPHPFOREXAMPLE,FOLLOWINGTHEPERFORMANCESTUDYONCGICOMMONGATEWAYINTERFACEBASEDWEBSERVERSFORDYNAMICCONTENTBYYEAGERMCGRATHBACKIN1995,RESEARCHERSANDPRACTITIONERSHAVEBEENEXAMININGTHEPERFORMANCEOFMORERECENTDYNAMICWEBCONTENTGENERATIONTECHNOLOGIESTHE
9、SEWORKS,HOWEVER,HANDLEAPPLICATIONSCENARIOSWHERESERVLETFRONTENDSIMPLEMENTRELATIVELYCOMPLEXBUSINESSLOGICALTHOUGHWARNERANDWORLEYDISCUSSTHEIMPORTANCEOFALSOUSINGPHPWITHSPECWEB2005,TOTHEBESTOFTHEAUTHORSKNOWLEDGE,THISPAPERISTHEFIRSTTOPUBLISHADETAILEDANALYSISOFSPECWEB2005EXPERIMENTALRESULTSUSINGBOTHPHPANDJS
10、PTHEDETAILEDANALYSISOFPHPANDJSPPERFORMANCEBASEDONSPECWEB2005OFFEREDBYTHISPAPERENABLESDESIGNERSANDIMPLEMENTERSOFWEBSERVERSTOUNDERSTANDTHERELATIVEPERFORMANCEANDTHROUGHPUTOFDIFFERENTVERSIONSANDCONFIGURATIONSOFPHPANDJSPTHERESTOFTHISPAPERISORGANIZEDASFOLLOWSSECTION2DISCUSSESMULTITIERWEBSERVERARCHITECTURE
11、ANDTHELIGHTWEIGHTFRONTENDAPPROACHUSINGPHPANDJSPSECTION3REPORTSONOURFINDINGSREGARDINGPHPANDJSPLANGUAGERUNTIMEMICROBENCHMARKPERFORMANCESECTION4DETAILSOURSPECWEB2005BENCHMARKMETHODOLOGY,ENVIRONMENT,ANDTESTCONFIGURATIONSSECTION5ANALYZESSPECWEB2005BENCHMARKTHROUGHPUTRESULTS,CPUUSAGEPROFILING,ANDRELATEDPE
12、RFORMANCEMETRICSSECTION6DISCUSSESTHEIMPORTANCEOFTHESERESULTSSECTION7COVERSRELATEDWORK,FOLLOWEDBYOURCONCLUSIONSINSECTION82MULTITIERWEBSERVERARCHITECTURELIGHTWEIGHTFRONTENDUSINGPHP/JSPDEVELOPERSTYPICALLYUSEPHPTOIMPLEMENTAFRONTENDINTERFACETODYNAMICWEBCONTENTGENERATORS,WHICHARECOMBINEDWITHWEBSERVERSOFTW
13、AREANDBACKENDSERVERSTOPROVIDEDYNAMICCONTENTTHEWEBSERVERDIRECTLYHANDLESREQUESTSFORSTATICCONTENTANDFORWARDSREQUESTSFORDYNAMICCONTENTTOTHEDYNAMICCONTENTGENERATORTHEDYNAMICCONTENTGENERATOR,SUPPORTEDBYBACKENDSERVERS,EXECUTESCODEWHICHREALIZESTHEBUSINESSLOGICOFAWEBSITEANDSTORESDYNAMICSTATEBACKENDSERVERSMAY
14、BEIMPLEMENTEDASASTRAIGHTFORWARDDATABASE,ORMAYBEMORECOMPLEXSERVERSHANDLINGTHEBUSINESSLOGICOFTHEWEBSITETHEFRONTENDIMPLEMENTATIONMAYVARYFROMHEAVYWEIGHTBUSINESSLOGICHANDLERSTOLIGHTWEIGHTCLIENTSCOMPOSINGCONTENTRECEIVEDFROMBACKENDSERVERSTHISPAPERFOCUSESONMULTITIERWEBSITEDEVELOPMENTSCENARIOSUTILIZINGSUCHLI
15、GHTWEIGHTFRONTENDS,SUPPORTEDBYONEORMORELAYERSOFHEAVYWEIGHTBACKENDSTHISASSUMPTIONISREASONABLEWHENCONSIDERINGSERVICEORIENTEDENVIRONMENTSWHEREPHPSCRIPTSAREUSEDTOIMPLEMENTA“MASHUP“OFSERVICESPROVIDEDELSEWHERE,INADDITIONTOTHECASEOFSIMPLEWEBSITESSUCHASBULLETINBOARDSWHEREPHPSCRIPTSAREJUSTAWRAPPERTOADATABASE
16、WITHINTHESCENARIOSDESCRIBEDINTHISPAPER,THEDYNAMICCONTENTGENERATORPROVIDESCLIENTIMPLEMENTATIONINADDITIONTOPAGECOMPOSITIONITCONNECTSTOTHEBACKENDSERVERTHROUGHANETWORKUSINGEITHERSTANDARDPROTOCOLSSUCHASHTTPORAPPLICATION/MIDDLEWARESPECIFICPROTOCOLSJSPTECHNOLOGYCANBECONSIDEREDANALTERNATIVETOPHPINIMPLEMENTI
17、NGSUCHFRONTENDSWHILEITISPARTOFTHEJAVASERVLETFRAMEWORK,DEVELOPERSTYPICALLYUSEJSPTOIMPLEMENTLIGHTWEIGHTFRONTENDSBOTHPHPANDJSPALLOWDEVELOPERSTOWRITEHTMLEMBEDDEDCODEINFACT,ALTHOUGHTHEREARELANGUAGEINHERENTDIFFERENCESBETWEENPHPANDJAVA,THEUSEOFPHPSCRIPTSANDJSPFILESCANBEVERYSIMILARTHEOBJECTIVEOFTHEEXPERIMEN
18、TSDETAILEDINTHISPAPERISTOMEASURETHEPERFORMANCEOFLIGHTWEIGHTFRONTENDDYNAMICCONTENTGENERATIONWRITTENINPHPANDJSPWITHPOPULARWEBSERVERSSUCHASAPACHEANDLIGHTTPDTHISWEBSERVERARCHITECTURESCENARIOINVOLVESUSERSWHOACCESSAWEBSERVERWITHPAGESWRITTENINPLAINSTATICHTML,ASWELLASJSPANDPHPSCRIPTSWHICHMIXSCRIPTINGLANGUAG
19、EWITHHTMLCODETHECONFIGURATIONASSUMEDWITHINTHEPAPERISATYPICALONE,WHEREWEBSERVERSOFTWARE,SUCHASAPACHE,DISTINGUISHESBETWEENPUREHTML,JSP,ANDPHPRESPECTIVELYWITHSUFFIXESSUCHASHTML,JSP,ANDPHPHTMLCODEISDIRECTLYRETURNEDTOTHEREQUESTINGENDUSERSWEBBROWSER,WHEREJSPANDPHPPAGESARERESPECTIVELYPARSEDBYTHETOMCATSCRIP
20、TENGINEANDTHEPHPRUNTIMEENGINEWHICHBOTHPROVIDEPUREHTMLWHICHISFORWARDEDTOTHEENDUSERONAREMOTESYSTEMACOMMONPOINTBETWEENJSPANDPHPISTHATIMPLEMENTATIONSWHICHPERFORMWELLHAVEADYNAMICALLYCOMPILEDANDCACHEDBYTECODEFOREXAMPLE,THEJAVARUNTIMEUSEDBYTHETOMCATSCRIPTENGINEWHICHWEUSEDPERFORMSMUCHBETTERWHENTHEJUSTINTIME
21、JITCOMPILERISENABLEDTOCREATEEFFICIENTCACHEDNATIVERUNTIMECODESIMILARLY,THEZENDPHPRUNTIMEWEUSEDALSOPERFORMSSIGNIFICANTLYBETTERWHENTHEALTERNATIVEPHPCACHEAPCISENABLED,INWHICHAPCSTORESPHPBYTECODESCOMPILEDFROMTHESCRIPTSOURCECODEINSHAREDMEMORYFORFUTUREREUSE3LANGUAGERUNTIMEPERFORMANCEMICROBENCHMARKINGTOUNDE
22、RSTANDTHEDIFFERENCEINPERFORMANCECHARACTERISTICSBETWEENPHPANDJAVAATTHELANGUAGERUNTIMELEVEL,WECOMPAREDTHEFOLLOWINGENGINESUSINGASERIESOFMICROBENCHMARKTESTSPHP447PHP523JAVA5WITHJUSTINTIMEJITCOMPILATIONIBMJ9VM150BUILD23JAVA5WITHOUTJUSTINTIMEJITCOMPILATIONSAMEASABOVETHEPHPLANGUAGEFRAMEWORKALLOWSDEVELOPERS
23、TOEXTENDTHELANGUAGEWITHLIBRARYFUNCTIONSWRITTENINCTHESEFUNCTIONS,WHICHAREKNOWNAS“EXTENSIONS“,ARETHENAVAILABLETOBEUSEDWITHINPHPSCRIPTSTHEPHPRUNTIMEPROVIDESAVARIETYOFEXTENSIONSFORSTRINGMANIPULATION,FILEHANDLING,NETWORKING,ANDSOFORTHSINCEOURFIRSTGOALWASTOUNDERSTANDTHEPERFORMANCEOFTHEPHPRUNTIMEITSELF,WEC
24、ONDUCTEDOUREXPERIMENTSWITHOUTTHEUSEOFEXTENSIONSWEDEVELOPEDTHEFOLLOWINGMICROBENCHMARKSAQUICKSORTBENCHMARKWHICHSORTS100INTEGERS,ALEVENSHTEINBENCHMARKWHICHMEASURESTHESIMILARITYBETWEENTWOSTRINGSOF56CHARACTERS,AFIBONACCIBENCHMARKWHICHCALCULATESTHE15THVALUEINAFIBONACCISERIESWITHTWOARBITRARYSTARTINGVALUEST
25、HESEPHPBENCHMARKSWEREIMPLEMENTEDENTIRELYWITHPHPLANGUAGEPRIMITIVESANDAVOIDEDTHEUSEOFPHPEXTENSIONSTHEJAVAVERSIONSALSOFOCUSEDONUSINGLANGUAGEPRIMITIVESRATHERTHANSTANDARDCLASSESWECOMPAREDTHETOTALRUNTIMEOFEXECUTINGEACHTEST10,000TIMESWITHEACHENGINEWEALSOEXECUTEDEACHBENCHMARKANADDITIONAL10,000TIMESASAWARMUP
26、,BEFORETHEMEASUREDTESTTHISPREVENTSJAVAJUSTINTIMECOMPILATIONOVERHEADFROMIMPACTINGTHESCOREINTHEJAVATESTSWERANTHEEXPERIMENTONANINTELPENTIUM4CPUAT340GHZWITH3GBRAMMEMORY,WITHTHELINUX2617KERNELTHISTESTDEMONSTRATESLARGEPERFORMANCEDIFFERENCESBETWEENEACHOFTHEMEASUREDSCRIPTINGLANGUAGESANDIMPLEMENTATIONSTHEEXP
27、ERIMENTALRESULTSINFIGURE1INDICATETHAT“JAVA5WITHJITCOMPILATION”PERFORMSTHEBEST,FOLLOWED“JAVA5WITHOUTJITCOMPILATION”,“PHP523”,AND“PHP447”INALLMEASUREDCASESJAVA5WITHJITDEMONSTRATEDNEARLYTHREEORDERSOFMAGNITUDEBETTERPERFORMANCEDUETOTHEUSEOFEFFICIENTLYGENERATEDNATIVECODEITISALSOOBVIOUSTHATPHP523HASATWOTOT
28、HREETIMESPERFORMANCEIMPROVEMENTOVERPHP447WITHTHEMEASUREDCOMPUTATIONSSECONDLYTODETERMINETHEPERFORMANCEEFFECTOFPHPEXTENSIONSCOMPAREDWITHJAVACLASSMETHODS,WEDEVELOPEDANDTESTEDTHREEADDITIONALMICROBENCHMARKSREGULAREXPRESSIONMATCHING,MD5ENCODING,ANDLEVENSHTEINCOMPARISONFORREGULAREXPRESSIONMATCHING,THEPERLC
29、OMPATIBLEREGULAREXPRESSIONEXTENSIONTHROUGHTHEPREG_MATCHFUNCTIONWASUSEDINPHP,ANDTHEJAVAUTILREGEXPACKAGEWASUSEDINJAVAFORMD5ENCODING,THEMD5EXTENSIONWASUSEDINPHPANDJAVASECURITYMESSAGEDIGESTWASUSEDINJAVATHISEXPERIMENTDOESNOTCOMPAREEXACTLYTHESAMELOGIC,BUTRATHERDEMONSTRATESTHATTHEUSEOFPHPEXTENSIONSISCOMPET
30、ITIVEWITHJAVAUSINGJUSTINTIMECOMPILATION,ASSEENINFIGURE2ALTHOUGHTHEPURESCRIPTEXPERIMENTSHOWEDTHREEORDERSOFMAGNITUDEDIFFERENCEBETWEENTHEPERFORMANCEOFVARIOUSIMPLEMENTATIONSOFJAVAANDPHP,THEUSEOFPHPEXTENSIONSWRITTENINCANDCOMPILEDJAVACLASSLIBRARIESSHOWMUCHLESSVARIATIONINTHEEXTREME,THEREGULAREXPRESSIONTEST
31、SHOWEDAMAXIMUMPERFORMANCEDIFFERENCEOFABOUTFIVETIMESBETWEENJAVAANDPHP,ONTHEOTHEREND,THEMD5TESTRESULTSWERENEARLYEQUIVALENTBETWEENJAVAANDPHPTHUSAINHERENTPERFORMANCERISKOFINTERPRETEDSCRIPTEDLANGUAGESSUCHASPHPCANBEOVERCOMEWITHTHEUSEOFEFFICIENTLIBRARYFUNCTIONSSUCHASPHPEXTENSIONSWRITTENINC译文PHP和JSP作为服务器端脚本
32、语言的性能比较资料来源计算机科学讲义作者SCOTTTRENT;MICHIAKITATSUBORI;TOYOTAROSUZUMURA;AKIHIKOTOZAWA和TAMIYAONODERA摘要动态脚本语言PHP已经成为非常流行的轻量级WEB执行应用程序,并广泛用作于WEB服务器端的脚本语言。为了对PHP和JSP的性能进行比较,我们使用了SPECWEB2005基准,它提供三个应用PHP和JSP的实施方案。本文介绍和对比了SPECWEB2005性能基准测试在不同的PHP和JSP使用流行的APACHEWEB服务器和LIGHTTPD配置执行的结果。尽管在PHP引擎解释执行微基准观察到,SPECWEB20
33、05基准收益率的实验结果使WEB服务器的实施者拥有有价值的性能数据。脚本语言运行时的效率仍然与终端到终端的性能有关。然而,一旦仔细架构和调整,语言运行时是一个比自己的WEB服务器的性能瓶颈要少。关键词PHP,JSP,SPECWEB,BENCHMARKING,WEB服务器1简介动态脚本语言PHP(PHP超文本预处理器)已经成为非常流行的轻量级WEB执行应用程序,并广泛用于访问数据库和其他中间件。2007年10月流行的APACHE模块安全空间进行的调查表明,37的APACHE服务器支持PHP功能,以10个百分点使它成为最流行的APACHE模块。企业正迅速实现与动态脚本语言,如PHP的面向服务的体系
34、结构环境的强大组合。然而,我们相信仍然有重要的性能问题涉及到PHP,它仍有待于被调查。本文重点介绍了动态脚本语言的使用来实现WEB服务器的前端接口。与此对应的方式,该行业标准的WEB服务器性能的基准SPECWEB2005利用PHP和JSP(JAVASERVER页面)。在这种情况下,脚本是用于执行动态页面生成,而不是复杂的业务逻辑的实现。与此相反的传统用途是基于JSP的复杂的业务逻辑实现。虽然有许多动态网页内容的研究,本文补充了这些研究的详细分析,重点在于PHP中。例如,下面就CGI(通用网关接口)基于WEB服务器的动态内容由耶格尔麦格拉思可追溯到1995年的性能研究,研究人员和从业者一直在研究
35、最近的动态的WEBCONTENT技术性能。这些作品,然而,处理应用程序方案在SERVLET前端实现相对复杂的业务逻辑。虽然华纳和沃利也使用PHP与SPECWEB2005,以作者所知的重要性,本文是首次发布了使用PHP和JSP的SPECWEB2005实验结果的详细分析。PHP和JSP的性能的详细分析是基于本文件所提供的SPECWEB2005,使设计者和实施者了解WEB服务器的相对性能,并通过把不同版本的PHP和JSP进行配置。本文的其余部分组织如下。第2节讨论多层WEB服务器体系结构和使用PHP和JSP的轻巧的前端方法。第3节我们的调查结果报告了关于PHP和JSP语言运行时的微基准性能。第四节细
36、述了SPECWEB2005基准测试的方法,环境,和测试配置。第5节通过CPU使用率分析,以及相关的性能指标分析SPECWEB2005基准标记结果。第6节讨论了这些结果的重要性。第7节包含了相关的工作,其次是第8节我们的结论。2多层WEB服务器架构使用PHP/JSP的轻量级前端开发人员通常使用PHP来实现一个生成动态WEB内容的前端界面,这与WEB服务器软件和后端服务器相结合,提供动态内容。该网站的服务器直接处理静态内容并转发请求动态内容生成动态内容。后端服务器支持动态内容生成,执行代码来实现一个网站和商店的动态状态的业务逻辑。后端服务器可以作为一个直接的数据库来实现,或者可能更复杂的服务器处理
37、该网站的业务逻辑。前端的执行可能有所不同于重量级的业务逻辑程序来处理从后端服务器接收轻量级客户端的内容。本文重点介绍多层WEB站点开发利用这种由一个或多个重量级后端层支持轻量级的前端。当考虑到面向服务的环境中PHP脚本用来实现提供其他地方的一个“混搭”的服务,这种假设是合理的。除了简单的网站情况下,例如公告板中PHP脚本只是一个包装到一个数据库。在本文中所描述的场景中,动态内容生成器提供动态内容页组成,除了客户端实现。它通过使用标准协议诸如HTTP或应用程序/中间件特定协议连接到后端服务器。JSP技术可以被认为是对PHP在执行这些前端的一种选择。虽然它是JAVASERVLET的框架的一部分,开
38、发人员通常使用JSP来实现轻量级前端。PHP和JSP允许开发人员可以编写HTML嵌入代码。事实上,虽然PHP和JAVA之间有着固有的不同之处,但PHP的脚本和JSP文件在使用上的差异可能会非常相似。在这份文件中详细介绍了实验的目的是衡量结合诸如APACHE和LIGHTTPD的流行WEB服务器,使用PHP和JSP编写的轻量级前端动态内容生成器性能。此WEB服务器架构方案涉及用户访问使用纯静态页面HTML编写的WEB服务器,以及JSP和PHP脚本混合脚本语言和HTML代码。本文内承担的配置是一个典型的,其中WEB服务器软件,如APACHE,后缀与纯粹的HTML,JSP和PHP等之间的区别分别是HT
39、ML,JSP和PHP。HTML代码是直接返回到最终用户请求的网络浏览器,在JSP和PHP页面分别由TOMCAT的脚本引擎和PHP运行时引擎提供纯HTML转发给最终在远程系统的用户进行解析。JSP和PHP之间的共同点是,这些执行良好的实现有一个动态编译和缓存的字节码。例如,JAVA运行时使用TOMCAT的脚本引擎,当实时(JIT)编译器功能来创建有效的本地缓存的运行时代码时我们执行越好。同样,我们使用了ZEND的PHP运行时当可替代的PHP缓存(APC)启用,则执行明显好,从共享内存中APC存储PHP字节码,以便将来重用脚本源代码。3语言运行时性能微标杆为了了解PHP语言运行时水平在性能特点上的
40、不同,我们比较了用微型基准测试一下引擎PHP的447PHP的523JAVA5与实时(JIT)编译(IBM的J9虚拟机150BUILD23)JAVA5不只是实时(JIT)编译(同上)PHP语言框架允许开发人员扩展这些用C语言编写的功能,这些功能被称为“扩展”,称为库函数的语言,然后提供给PHP脚本内使用。PHP运行时提供了多种扩展的字符串操作,文件处理,网络等等。由于我们的首要目标是了解PHP运行时本身的性能,我们实施的实验没有使用扩展。我们制定了以下微基准以100个整数进行快速排序的基准一个LEVENSHTEIN基准检测两行56个字符的字符串的相似性一个斐波纳契计算基准,在一个任意两个初始值斐
41、波纳契数列第15的值。这些PHP的基准完全用PHP原始语言实现和避免了PHP扩展的使用。JAVA的版本也侧重于利用原始的语言而不是标准类的语言。我们比较了每个引擎执行每个测试10000次的总运行时间。每个测试前我们也执行作为热身的额外10000次测量基准。这可以防止在JAVA影响得分的测试中即时编译。我们在340GB的RAM内存,4CPU的INTEL奔腾与LINUX2617内核上运行实验。此测试演示测量之间的脚本语言和实现的巨大性能差异。图1中的实验结果表明,“JIT编译的JAVA5”性能最好,在所有测量案件中“没有JIT编译的JAVA5”,“PHP的523”,“PHP的447”次之。JAVA
42、5基于有效地生成本地代码使用,结合JIT演示了近三个数量级更好性能的订单。显而易见的是,PHP的523有两倍至三倍的性能改进超过实际测量计算的PHP的447。其次,以PHP与JAVA类的方法相比确定扩展性能的影响,我们开发和测试三种额外的微基准常规的表达式匹配,MD5编码和LEVENSHTEIN比较。对于常规表达式匹配,PERL兼容常规表达式扩展(通过PREG_MATCH函数)使用PHP和在JAVA中使用JAVAUTILREGEX包。对于MD5编码,MD5的扩展也在PHP中使用和在JAVA中使用JAVASECURITYMESSAGEDIGEST。这个实验没有比较完全相同的逻辑,而是表明PHP扩展的使用与JAVA即时编译竞争,如图2所示。尽管实验结果显示纯脚本的三个数量级在JAVA和PHP上实现更少的性能差异订单,但是PHP的扩展使用(用C语言编写)和编译JAVA类库的变化表现出很大的不同。在极端情况下,正常的表达式测试显示JAVA和PHP之间最高的性能差异大约为5分钟,在另一方面,JAVA和PHP在MD5测试结果中几乎相等。因此,一个例如PHP等脚本语言解释的固有性能风险是可以利用高效率的库函数来克服的,如使用C语言编写的PHP扩展。