|
Quote: I do not understand what is code bench marking and when to use it Benchmarking is measuring the time for a specific task. Because the time may vary for multiple reasons, the measurement is repeated multiple times. These multiple measurements are then statistically analysed.
It is commonly used to compare results from different implementations and/or different hardware to find the fastest one. It is also used for marketing. Just have a look at CPU (AMD vs. Intel) and GPU (AMD vs. Nvidia) test reports.
Quote: what kind of output and benefit i can expect from code bench marking ? The ouput depends on the used benchmarking tool. In general it is some kind of speed index. The benefit can be selecting the best implementation for specific tasks and/or different platforms (e.g. running on different types of CPUs like x86 and ARM).
Quote: so anyone tell me what kind of output it is The results shown in your post are:
Mean
The average time (sum of all times divided by number of measurements) or the statistics mean. See Mean - Wikipedia[^].
Error
The Standard error - Wikipedia[^] (commonly for the mean value).
StdDev
The Standard deviation - Wikipedia[^].
Which values are shown here should be mentioned in the documentation for the benchmark.
Quote: where this output will be showing in console or debug window ? That depends on the used benchmark tool.
|
|
|
|
|
can you suggest any good free bench marking tool which i can use to measure various class function written in .net. thanks for good elaboration answer. have a nice day.
|
|
|
|
|
Visual Studio.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
which tool exist in VS IDE to benchmark code. which VS version you are talking about. i am using VS2013. thanks
|
|
|
|
|
Did you not read the blog post you linked to?
BenchmarkDotNet[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
[Benchmark]
public byte[] Sha256() => sha256.ComputeHash(data);
how to benchmark single line of code instead of whole function.......any idea?
because Benchmark attribute can i use for single line code inside function?
|
|
|
|
|
I added a resource file LocalizedTexts.resx to a project. The designer automatically added a class MyNamespace.LocalizedTexts to that project. Then I added a string resource MyResourceName to LocalizedTexts , and the designer created the static property internal static string MyResourceName in that class.
How can I get the full name of that property, i.e. MyNamespace.LocalizedTexts.MyResourceName , in a "compile-time" static way?
nameof(LocalizedTexts.MyResourceName) returns MyResourceName only, I could write nameof(MyNamespace)+"."+nameof(LocalizedTexts)+"."+nameof(MyResourceName) , but that looks like a WTF...
I need something compile time static because I'd like to use it with an Attribute .
Thanks for your hints.
Oh sanctissimi Wilhelmus, Theodorus, et Fredericus!
|
|
|
|
|
Bernhard Hiller wrote:
nameof(MyNamespace) + "." + nameof(LocalizedTexts) + "." + nameof(LocalizedTexts.MyResourceName)
I suspect that's the only option - unless you feel like writing a customised version of Roslyn to add a fullnameof operator.
The compiler will generate a single string constant, so you won't incur the cost of concatenating the strings at runtime.
If you didn't have the compile-time constant restriction, you could use string interpolation instead. But that possibly looks even worse:
$"{nameof(MyNamespace)}.{nameof(LocalizedTexts)}.{nameof(LocalizedTexts.MyResourceName)}"
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thanks for your answer. Since the attribute is under my control, I could modify it: I added a property for the ResourceType. Meant that I had to modify a few hundred places where it was used, but it works...
Strange that sometimes such "easy" ideas require such a lot of work-around.
Oh sanctissimi Wilhelmus, Theodorus, et Fredericus!
|
|
|
|
|
what is the benefit of delegets and how it is differ from Event and how it handled?
|
|
|
|
|
Delegates
Briefly, delegates are reference to method and they are important because they represent callback to your asynchronous operations i.e. events: you may never know when particular event encounters but you might want to handle it exactly once it's there
|
|
|
|
|
Events are Delegates as a very simple Google would have found you: delegets and how it is differ from Event - Google Search[^]
Follow a few of the links, read a few of the answers at SO and CP - if that doesn't clear it up for you, come back and explain exactly what you don't understand.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
can i use try catch finally in PHP?
|
|
|
|
|
This is the C# forum. Have you tried the PHP documentation?
|
|
|
|
|
Apart from trying the right forum: Linux, Apache, MySQL, PHP Discussion Boards[^] or Ask A Question[^], Google is your friend: Be nice and visit him often. He can answer questions a lot more quickly than posting them here...
A very quick search using your subject as the search term gave over two million hits: try catch finally in PHP - Google Search[^]
The top "summary" and link tells you the answer by reference to the standard documentation!
PHP: Exceptions - Manual[^]
In future, please try to do at least basic research yourself, and not waste your time or ours.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Some time I make method for example the treenode in treeview some programmer write the code in four lines and it flexible me I write many lines and it is not flexible so if you have articles ,books help me to be proffessional make me call the method it self many times it will be nice.
this is my code:
<pre> public void FillTreeViewWith5(string Query1, string Query2, string Query3, string Query4,
string Query5,string Query6,string Query7, DataSet Ds, TreeView tr, TreeNode tn1,
TreeNode tn2, TreeNode tn3, TreeNode tn4, TreeNode tn5,TreeNode tn6,TreeNode tn7)
{
int z = 0;
int r = 0;
int res;
string i1;
string i2;
string i3;
string i4;
string i5;
string i6;
tr.Nodes.Clear();
SqlDataAdapter da1 = new SqlDataAdapter(Query1,con);
da1.Fill(Ds, "d1");
for (int i = 0; i < Ds.Tables["d1"].Rows.Count; i++)
{
i1 = Ds.Tables["d1"].Rows[i][0].ToString();
string x1 = Ds.Tables["d1"].Rows[i][1].ToString();
tn1 = new TreeNode(x1);
SqlCommand cmd2 = new SqlCommand();
cmd2.Connection = con;
cmd2.CommandText = Query2;
cmd2.Parameters.AddWithValue("@i1", i1);
SqlDataAdapter da2 = new SqlDataAdapter(cmd2);
da2.Fill(Ds, "d2");
for (int j = 0; j < Ds.Tables["d2"].Rows.Count; j++)
{
i2= Ds.Tables["d2"].Rows[j][0].ToString();
string x2 = Ds.Tables["d2"].Rows[j][1].ToString();
tn2 = new TreeNode(x2);
tn1.Nodes.Add(tn2);
SqlCommand cmd3 = new SqlCommand();
cmd3.Connection = con;
cmd3.CommandText = Query3;
cmd3.Parameters.AddWithValue("@i2", i2);
SqlDataAdapter da3 = new SqlDataAdapter(cmd3);
da3.Fill(Ds, "d3");
for (int b = 0; b < Ds.Tables["d3"].Rows.Count; b++)
{
i3 = Ds.Tables["d3"].Rows[b][0].ToString();
string x3 = Ds.Tables["d3"].Rows[b][1].ToString();
tn3 = new TreeNode(x3);
tn2.Nodes.Add(tn3);
SqlCommand cmd4 = new SqlCommand();
cmd4.Connection = con;
cmd4.CommandText = Query4;
cmd4.Parameters.AddWithValue("@i3", i3);
SqlDataAdapter da4 = new SqlDataAdapter(cmd4);
da4.Fill(Ds, "d4");
for (int c = 0; c < Ds.Tables["d4"].Rows.Count; c++)
{
i4 = Ds.Tables["d4"].Rows[c][0].ToString();
string x4 = Ds.Tables["d4"].Rows[c][1].ToString();
tn4 = new TreeNode(x4);
tn3.Nodes.Add(tn4);
SqlCommand cmd5 = new SqlCommand();
cmd5.Connection = con;
cmd5.CommandText = Query5;
cmd5.Parameters.AddWithValue("@i4", i4);
SqlDataAdapter da5 = new SqlDataAdapter(cmd5);
da5.Fill(Ds, "d5");
for ( int m= 0; m <Ds.Tables["d5"].Rows.Count ; m++)
{
i5 = Ds.Tables["d5"].Rows[m][0].ToString();
string x5= Ds.Tables["d5"].Rows[m][1].ToString();
tn5 = new TreeNode(x5);
tn4.Nodes.Add(tn5);
SqlCommand cmd6 = new SqlCommand();
cmd6.CommandText = Query6;
cmd6.Connection = con;
cmd6.Parameters.AddWithValue( "@i5",i5);
SqlDataAdapter da6 = new SqlDataAdapter(cmd6);
da6.Fill(Ds, "d6");
for (int p= 0; p < Ds.Tables["d6"].Rows.Count; p++)
{
i6 = Ds.Tables["d6"].Rows[p][0].ToString();
string x6 = Ds.Tables["d6"].Rows[p][1].ToString();
tn6 = new TreeNode(x6);
tn5.Nodes.Add(tn6);
SqlCommand cmd7 = new SqlCommand();
cmd7.CommandText = Query7;
cmd7.Connection = con;
cmd7.Parameters.AddWithValue("@i6", i6);
SqlDataAdapter da7 = new SqlDataAdapter(cmd7);
da7.Fill(Ds, "d7");
res=Ds.Tables["d7"].Rows.Count;
for (r = z; r < res; r++)
{
string i7 = Ds.Tables["d7"].Rows[r][0].ToString();
string x7 = Ds.Tables["d7"].Rows[r][1].ToString();
tn7 = new TreeNode(x7);
tn6.Nodes.Add(tn7);
}
z = r;
res = res + res;
}
}
}
}
}
}
tr.Nodes.Add(tn1);
tr.ExpandAll();
}
the proffessional programmer code:
<pre>private void AddTreeNode(TreeNode parentNode, DataTable table, int parentId)
{
var filteredRows = table.AsEnumerable().Where(r => Convert.ToInt32(r["parent_id"]) == parentId).ToList();
foreach(DataRow row in filteredRows)
{
TreeNode node = new TreeNode(row["Re_nm"].ToString());
if (parentNode == null)
tr.Nodes.Add(node);
else
parentNode.Nodes.Add(node);
AddTreeNode(node, table, Convert.ToInt32(row["Re_id"]));
}
}
|
|
|
|
|
|
i know c# is designed from c and c++ concept and it is based on OOPS, i want to know that c# only based on OOPS or any new concept is there?
|
|
|
|
|
|
Ummm... It's Object Oriented Programming (OOP), not OOPS.
|
|
|
|
|
Dave Kreskowiak wrote: not OOPS You have not seen the OPs code !
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
True, and I think I want to protect my eyes, thank you.
|
|
|
|
|
how can i add membership with expiry date ?
user needs to purchase membership on my website with account for getting access to program
|
|
|
|
|
Add the information to the user's account entry in the database.
|
|
|
|
|
i have this code
var Result = from x in db.vams
join y in db.ghests
on new { X1 = x.code_sabt } equals new { X1 = y.code_sabt }
where y.code_vam == (from z in db.vams where z.code_sabt == myuser select z.row_codevam).Max()
group y by x.row_codevam into g
select new
{
sum_ghest = g.Sum(k=>k.price),
i need-----> x.colimns :( :( :(
};
how can i access to
db.vams columns in the select new part??????
|
|
|
|