有谁知道可以测量工作强度的效用.例如 - 每秒击键\鼠标点击次数,在IDE \其他开发人员工具中花费的时间,每小时的总代码行数等等.
如果我有一个带有按钮的网站怎么办。用户单击按钮并开始一个长时间运行的过程。几小时(或几分钟)后,用户更新网页并查看结果。在网站上实现长期运行的最佳(和任何其他)方法是什么?
我需要超级快速存储并通过两个整数键检索值.
所以我有输入值uint Id1, uint Id2,需要得到uint Count.
我也知道最大值Id1和Id2(约为5 000 000).
我目前的实现大约占应用程序工作时间的70%,可能需要几天时间.
它只是使用标准的.net词典,当然可以改进.但我想这是计算机科学中非常有用的操作,毫无疑问存在更高效的算法.
这是我的实施
void Main()
{
var rep = new Repository();
var sw = new Stopwatch();
sw.Start();
for (uint i = 0; i < 10000; i++)
{
for (uint j = 0; j < 1000; j++)
{
rep.Add(new DomainEntity(){Id1 = i, Id2 = j, Count = 1});
}
}
for (uint i = 0; i < 10000; i++)
{
for (uint j = …Run Code Online (Sandbox Code Playgroud) 如何正确选中和取消选中复选框?我有很多麻烦.
这是我的代码http://jsfiddle.net/N5Swt/:
<input type="checkbox" id="checkbox1" /> <span> Check me! </span>
// test1
/*$('#checkbox1').attr('checked','true');
$('#checkbox1').attr('checked','false');*/ // This line doesnt work
// test2
$('#checkbox1').attr('checked','true');
$('#checkbox1').removeAttr('checked');
$('#checkbox1').attr('checked','true'); //This line doesnt work
Run Code Online (Sandbox Code Playgroud)
它不起作用.为什么?
即使它有引用(c#或Java),我如何删除对象?
例如:
void Main()
{
var f = new Foo();
var person = f.GetPerson();
}
public class Foo
{
private object _person;
public Foo()
{
_person = new object();
}
public object GetPerson()
{
return _person;
}
}
Run Code Online (Sandbox Code Playgroud)
我想从内存中删除_person我该怎么办?
我构建了一个测试并获得了以下结果:
分配类:15.3260622,分配结构:14.7216018.
分配结构而不是类时看起来有4%的优势.这很酷但是真的足以添加语言值类型吗?在哪里可以找到一个显示结构真正击败类的例子?
void Main()
{
var stopWatch = new System.Diagnostics.Stopwatch();
stopWatch.Start();
for (int i = 0; i < 100000000; i++)
{
var foo = new refFoo()
{
Str = "Alex" + i
};
}
stopWatch.Stop();
stopWatch.Dump();
stopWatch.Restart();
for (int i = 0; i < 100000000; i++)
{
var foo = new valFoo()
{
Str = "Alex" + i
};
}
stopWatch.Stop();
stopWatch.Dump();
}
public struct valFoo
{
public string Str;
}
public class refFoo
{
public string Str;
}
Run Code Online (Sandbox Code Playgroud) c# ×4
performance ×3
asp.net ×1
checkbox ×1
class ×1
hashtable ×1
java ×1
javascript ×1
jquery ×1
struct ×1