nokogiri 的xpath方法比 ancestor() 快的多(nokogiri xpath() is much faster than ancestor() )
访问量: 2705
for short: using xpath will save your 95% cpu time than using ancestor().first
我的一个方法,原来使用了 .ancestors().first , 运行一次3 分钟。
后来改成了 xpath('./ancestor::table[1]') , 运行一次 5秒。 节省了大约96%的时间!
Finished in 5.81 seconds 3 examples, 0 failures