while( result_set.next() )
{
...
}
Run Code Online (Sandbox Code Playgroud)
我已经使用System.nanoTime()并计算了时间,对于每次迭代,所花费的时间以毫秒为单位,但整个循环大约需要16秒.我正在考虑条件测试花费大量时间的可能原因,即next()功能.
仅供参考我正在连接到远程数据库服务器,并且我使用上述方法再次计算完成的选择查询(以毫秒为单位).有关它为什么会发生的原因以及如何将结果集迭代到最多一秒的时间?
编辑:
我正在处理大约4000条记录,每条记录包含大约10列,每列大约有10个字符
EDIT2 谢谢setFetchsize()做了神奇,真棒,真棒
是否有替代方法可以为物理模拟制作教育Java小程序,如弹丸运动,重力等?
我正在寻找一种方法,可以将wxPython GUI元素添加到pygame中.如果有替代方法可以解决将GUI元素添加到pygame的目的,请提示.我在安装PGU时遇到问题.谢谢你的帮助.
在这段代码中,我在java中实现了一个通用链表.
public class LL<Item extends Comparable<Item>> {
Run Code Online (Sandbox Code Playgroud)
我的Node类被定义为
private class Node{
private Item data;
private Node next;
public Node(Item data){
this.data = data;
next = null;
}
}
Run Code Online (Sandbox Code Playgroud)
现在我的疑问是,我在编码时不断收到警告
Node x = head, y = (Node) b.head;
Type safety: Unchecked cast from LL.Node to LL<Item>.Node
Run Code Online (Sandbox Code Playgroud)
我应该忽略这一点,为什么编译器会生成它.它有解决方法吗?
编辑:
b是LL类型,函数签名看起来像
public void mergeAlternate(LL b){
Run Code Online (Sandbox Code Playgroud)
head是LL类的私有实例变量
private Node head;
Run Code Online (Sandbox Code Playgroud) 下面是从互联网上下载大约9000行的txt文件并填充数据库的代码,我已经尝试了很多,但需要花费大量时间超过7分钟.我使用win 7 64 bit和ruby 1.9.3.有没有办法更快地做到这一点?
require 'open-uri'
require 'dbi'
dbh = DBI.connect("DBI:Mysql:mfmodel:localhost","root","")
#file = open('http://www.amfiindia.com/spages/NAV0.txt')
file = File.open('test.txt','r')
lines = file.lines
2.times { lines.next }
curSubType = ''
curType = ''
curCompName = ''
lines.each do |line|
line.strip!
if line[-1] == ')'
curType,curSubType = line.split('(')
curSubType.chop!
elsif line[-4..-1] == 'Fund'
curCompName = line.split(" Mutual Fund")[0]
elsif line == ''
next
else
sCode,isin_div,isin_re,sName,nav,rePrice,salePrice,date = line.split(';')
sCode = Integer(sCode)
sth = dbh.prepare "call mfmodel.populate(?,?,?,?,?,?,?)"
sth.execute curCompName,curSubType,curType,sCode,isin_div,isin_re,sName
end
end
dbh.do "commit"
dbh.disconnect
file.close …Run Code Online (Sandbox Code Playgroud)