Hello:
I've been thinking about nested try/catch statements and started to think about under which conditions, if any, the JIT can perform an optimization or simplification of the compiled IL.
To illustrate, consider the following functionally-equivalent representations of an exception handler.
// Nested try/catch
try
{
try
{
...
I have two database tables with the following structure:
actions:
action_id int(11) primary key
action_name varchar(255)
action_module varchar(45)
permissions:
perm_id int(11) primary key
perm_role int(11)
perm_action int(11)
perm_status int(11)
Now I have to check whether there is an entry in the permission...
I have a C++ application running on Windows that wakes up every 15 mins to open & read files present in a directory. The directory changes on every run.
open is performed by *ifstream.open(file_name, std::ios::binary)*
read is performed by streambuf ios::rdbuf()*
Total number of files every 15 mins is around 50,000
The files are opene...
What can be the various performance testing scenarios to be considered for a website with huge traffic? Is there any way to identify the elements of the code which are adversely affecting the site performance?
Please provide something similar to checklist of generalised scenarios to be tested to ensure proper performance testing.
...
I have a memory block that is divided into a series of location that can be retrieved and returned by client code.
The method that returns locations back looks like this:
void ReturnLocation(void *address) {
int location = AddressToLocation(address); // I need the location here
// some code
DoSmthA(location);
}
void DoSmth...
Right, this code goes through a rather large multidimensional array (has about 28,000 rows and 16 parts).
Order of events:
Check if the data exists in the database
if it exists - Update it with the new data
if it doesn't exist - Insert it
Simple.
But right now to go through this it has taken over 30min i think and Still going.
$c...
I am adding a splash screen to a .NET compact application and am wondering if there's an elegant way to access the correct bitmap (based on screen resolution) for the splash screen.
e.g. My resource bitmap properties are named like this...
Splash640480
Splash480640
Splash480480
Splash320240
Splash240320
Splash240240
... etc
I tr...
I'm drawing quads in openGL. My question is, is there any additional performance gain from this:
// Method #1
glBegin(GL_QUADS);
// Define vertices for 10 quads
glEnd();
... over doing this for each of the 10 quads:
// Method #2
glBegin(GL_QUADS);
// Define vertices for first quad
glEnd();
glBegin(GL_QUADS);
// Define vertices for...
I am trying to show by example that the prefix increment is more efficient than the postfix increment.
In theory this makes sense: i++ needs to be able to return the unincremented original value and therefore store it, whereas ++i can return the incremented value without storing the previous value.
But is there a good example to show t...
In T-SQL what's faster?
DELETE * FROM ... WHERE A IN (x,y,z)
Or
DELETE * FROM ... WHERE A = x OR A = y OR A = z
In my case x, y and z are input parameters for the stored procedure. And I'm trying to get the performance of my DELETE and INSERT statements to the best of my abilities.
...
Is there a flag or other reliable method to detect if a compiled C++ binary was compiled with optimizations?
I'm okay with compiler-specific solutions.
Edit: This is for a build deployment system, which could accidentally deploy binaries that were not built properly. A water-tight solution is unlikely, but it will save some pain (an...
I want to know if the below code:
<?php
printf ("%s", $some_variable);
?>
is more efficient than:
<?php
echo "$some_variable";
?>
One common complaint of variable interpolation is that it is very slow. I want to know if there is a better alternative to variable interpolation that doesn't make one's code as messy as:
<?php
echo $fi...
Here's some code (full program follows later in the question):
template <typename T>
T fizzbuzz(T n) {
T count(0);
#if CONST
const T div(3);
#else
T div(3);
#endif
for (T i(0); i <= n; ++i) {
if (i % div == T(0)) count += i;
}
return count;
}
Now, if I call this template function wit...
Hi there.
I noticed with -O2 level optimization using gcc 4.1 built on IBM AIX (for use with 5.3 and 6.1) that a bunch of lwz rxxx,offsetyyy(r2) sequences are added to an inline sequence, before bctrl (calling a method or function) is done. After the register is loaded, it is never used again after the return from the method or function...
Since I version all my css/js/images, they never "change". It might go from sprite.4.png to sprite.5.png, but sprite.4.png will never change.
Anyway, it seems pointless for the browsers to be checking for modified versions and receiving 304 responses, so what do I need to put in .htaccess to prevent these last modified look ups?
Right ...
Hello,
I've seen comments on SO saying "<> is faster than =" or "!= faster than ==" in an if() statement.
I'd like to know why is that so. Could you show an example in asm?
Thanks! :)
EDIT:
Source
Here is what he did.
function Check(var MemoryData:Array of byte;MemorySignature:Array of byte;Position:integer):boolean;
var i:by...
Does Drupal parse (and/or run) hooks that are unrelated to the content being loaded by the current user?
For example, say I had a module foo installed and active with the following hooks:
<?php
// .. stuff ...
function foo_menu() {
$items = array();
$items['foo/show'] = array(
'title' => t('Foo!'),
'pa...
In PHP switch statements, does placing more common cases near the top improve performance?
For example, say the following function is called 1,000 times:
<?php
function foo_user ($op) {
switch ($op) {
case 'after_update':
//Some Stuff
case 'login':
//Some other Stuff
}
}
If in 990 of the 1,000 of the tim...
So I'm at the stage in web programming where I'm past the "Look, Ma, I can put data in a grid and it shows up on the page." I'm now at the, wow, this site is not as snappy as I want it to be. So, I enabled the "Net" tab in Firebug, closed my eyes, crossed my fingers, and went spelunking.
The first thing I noticed is that all of my .as...
So I want to make sure all of my database / network operations are not happening on the UI thread of my application. To do this I normally use the BeginInvoke function to make the call and then Invoke to do the actual update. I am not sure if I am doing things correctly compared to the way it should be done. Could anyone please provid...