我编写了一个脚本来从站点中提取某些信息,代码运行良好但速度非常慢(我已经编译了函数并启用了 JIT),我如何检查延迟是否是由于网页流量造成的?任何帮助,将不胜感激
url = "http://www.currys.co.uk/gbuk/computing-accessories/accessories-and-bags/power- cables/power-cables-adaptors/masterplug-bfg2-mp-4-gang-extension-cable-2m-00852134-pdt.html? srcid=369&xtor=AL-1&cmpid=aff~!!!sitenamecm!!!~!!!promotypecm!!!~Computing+Accessorie"
getpagedata = function (url, uniq_id)
{
srcpage = getURLContent(parenturl)
page = htmlTreeParse(srcpage,useInternalNodes = T,encoding='UTF-8')
link = '0'
availability = xpathSApply(page, "//span[@class ='available']",xmlValue)
if (length(availability) > 0 )
{
if (length(availability_option) > 0)
{
availability_option = paste0(toString(str_replace_all(availability_option,"\n|\t","")),",")
}
availability = paste0("'",availability_option,toString(str_replace_all (availability,"\n|\t","")),"'")
}
df2 = data.frame(starttime,Sys.time(),store,uniq_id,Avail_Flag,availability,link)
writetofile_c(df2)
free(page)
}
谢谢,