Exact Duplicate: Is there a performance difference between i++ and ++i in C++?
Exact Duplicate: Why should I use ++i?
Exact Duplicate: Difference between i++ and ++i in a loop?
What is more efficient i++ or ++i?
I have only used this in Java and C/C++, but I am really asking for all languages that this is implemented in.
In colleg...
Is variable assignment expensive compared to a null check? For example, is it worth checking that foo is not null before assigning it null?
if (foo != null) {
foo = null;
}
Or is this worrying about nothing?
...
I have two lists - let's call them details and totals.
The items in details have multiple elements for each key that the list is sorted on, as such:
KEY1
KEY1
KEY2
KEY2
KEY3
KEY3
KEY3
etc
The items in totals will only have each key once, as such:
KEY1
KEY2
KEY3
etc
Both lists are sorted by key already. The lists need to be combined...
I have code like this, and I find it a bit hard to read:
// code1
if( (expensiveOperation1() && otherOperation() && foo())
|| (expensiveOperation2() && bar() && baz()) {
// do something
}
I just changed it to the following, to make it more readable:
// code2
const bool expr1 = expensiveOperation1() && otherOperation() && foo(...
our office just got this new guy with lots of experience and kept insisting that we stop using absolute paths like: http://somesite.com/subdir1/images/filename.ext when pointing to a path of our image when it resides next to the file that calls it say we could have just used: ./subdir1/images/filename.ext
but the reason why we used abso...
I know, I'm asking a lot of questions...but as a new delphi developer I keep falling over all these questions :)
This one deals with TCP communication using indy 10. To make communication efficient, I code a client operation request as a single byte (in most scenarios followed by other data bytes of course, but in this case only one sin...
The .Net framework now has (at least) four different methods of reading an Xml string. I've used each of XmlDocument, XmlReader, XPath and XElement, but which is the most efficient to use when coding or during execution? Is each designed for a different task, what are the pros and cons?
Update:
Using a XmlReader appears to be the quic...
Hello,
I'm extensively using hash map data structures in my program. I'm using a hash map implementation by Barry Kelly posted on the Codegear forums. That implementation internally uses RTL's CompareText function. Profiling made me realize that A LOT of time is spent in SysUtils CompareText function.
I had a look at the
Fastcode site...
The standard PHP way to test whether a string $str ends with a substring $test is:
$endsWith = substr( $str, -strlen( $test ) ) == $test
Is this the fastest way?
...
I'm working on a PHP/MySQL rating system right now. For the user to be able to rate the user has to log in. Each user has a unique "UID". There will be multiple rating instances on the website (one for every game, in my case) and I need an efficient way of storing a list of UIDs in a MySQL row (one MySQL row in the ratings table for each...
This post is a follow-up of this answered question: Best method for storing a list of user IDs.
I took cletus and Mehrdad Afshari's epic advice of using a normalized database approach. Are the following tables properly set up for proper optimization? I'm kind of new to MySQL efficiency, so I want to make sure this is effective.
Also,...
I have always hoped and assumed that it is not - that set theory (or something) provides a shortcut to the result.
I have created a non-updateable view that aggregates data from several tables, in a way that produces an exponential number of records. From this view, I query one record at a time. Because the underlying dataset is small, ...
I'm writing PHP code to parse a string. It needs to be as fast as possible, so are regular expressions the way to go? I have a hunch that PHP string functions are more expensive, but it's just a guess. What's the truth?
Here's specifically what I need to do with the string:
Grab the first half (based on the third location of a substrin...
I've just installed resharper and it's letting me know the namespaces i'm not actually using in each of my classes.
which lead me to the question - is there actually any overhead in leaving these, unused, using declarations in?
is it just a matter of tight code, or is there a performance hit in invoking these namespaces when i don't ne...
At Disney World, they use a system called Fastpass to create a second, shorter line for popular rides. The idea is that you can wait in the standard line, often with a wait longer than an hour, or you can get a FastPass which allows you to come back during a specified time block (usually a couple hours later) and only wait for 10 minute...
I am building a simple blog which is viewed single-page (do not worry, it is progressively built) and thus I am sending AJAX requests which return HTML to be inserted into the page.
What is the most efficient way to store/cache information (HTML) to be added at a later time into the DOM?
How much information (old entries which the user...
I'd like to know how you address the seemingly low productivity of JEE-based web application development compared to other technology stacks (Seaside, Ruby on Rails, etc).
The constraints are:
The finished web application must be deployable on JEE compliant application containers
If possible, previous investment in Java-based solution...
Our system runs on SQL Server 2000, and we are in the process of preparing for an upgrade to SQL Server 2008. We have a lot of trigger code where we need to detect a change in a given column and then operate on that column if it has changed.
Obviously SQL Server provides the UPDATE() and COLUMNS_UPDATED() functions, but these functions...
When working with Windows forms in C#, is it safer/more beneficial resource-wise to completely close the form each time and reload the data when you need the form again, as opposed to just hiding the form and keeping it all in memory?
...
The title to this question isn't written very well. Sorry 'bout that.
I'm curious what the pros or cons would be to increasing the scope of an object instance within a method to the class level.
As a specific example, I have a non-static service class that wraps access to a repository class which is used to manage CRUD activity as w...