I had always assumed that the Python interpreter did no optimizations without a -O flag, but the following is a bit strange:
>>> def foo():
... print '%s' % 'Hello world'
...
>>> from dis import dis
>>> dis(foo)
2 0 LOAD_CONST 3 ('Hello world')
3 PRINT_ITEM
4 PRINT_NEW...
Here are two ways to set an individual bit in C on x86-64:
inline void SetBitC(long *array, int bit) {
//Pure C version
*array |= 1<<bit;
}
inline void SetBitASM(long *array, int bit) {
// Using inline x86 assembly
asm("bts %1,%0" : "+r" (*array) : "g" (bit));
}
Using GCC 4.3 with -O3 -march=core2 options, the C version t...
I am trying optimize my code. I fetching the data using hibernate, when i am running the query directly on the database it fetching the results in 2secs, rowcount around 2800. Same query when i fire from my java code takes 8 secs. i have included the code sniplet below.
Please help me out on this, its very urgent.
Session hSession =open...
Consider the following:
struct Point {double x; double y;};
double complexComputation(const& Point p1, const Point& p2)
{
// p1 and p2 used frequently in computations
}
Do compilers optimize the pass-by-reference into pass-by-copy to prevent frequent dereferencing? In other words convert complexComputation into this:
double comp...
I've read that making a class sealed in C# is advisable in high-performance scenarios because it frees the compiler to make certain optimizations (e.g., inlining property getters) that it wouldn't be able to make otherwise. Is the same true for NotInheritable in VB.NET? My guess would be yes, but I'm posting this question in case someone...
In a non-template class, is there any reason to prefer function return signatures in the form const <type>& foo(); versus <type> foo();? Where <type> is an intrinsic type. What about if <type> is a class/struct object?
Also interested in whether or not the function being const makes a difference: const <type>& foo() const; to <type> fo...
Is there any software package/library that will produce a consolidated, minified JavaScript file for a production environment, while leaving the original files/references as-is in a development environment (so developers can work independently)?
JAWR does this (and more) for a Java/Groovy environment, but I haven't seen anything like it...
Hi,
I'm new to Actionscript (v3), 20 years C++ though, and I'm just trying to get my head around some of the performance caveats I'm reading.
I checked out this site:
http://www.nbilyk.com/optimizing-actionscript-3
and was scared to death of the 'code' section saying that Actionscript has to do a dynamic lookup when trying find stati...
I've been toying around with the Parallel library in .NET 4.0. Recently, I developed a custom ORM for some unusual read/write operations one of our large systems has to use. This allows me to decorate an object with attributes and have reflection figure out what columns it has to pull from the database, as well as what XML it has to outp...
I'm trying to create a custom control in WPF to display the game tree for a game of go (see here for what it looks like). I've more-or-less got it working laying out the nodes, but one problem I've found is that it begins gets noticeably slow to render/navigate (it's in a scroll viewer) when the number of nodes gets larger than about 30....
My initial goal when writing this was to leave the smallest footprint possible. I can say with confidence that this goal has been met. Unfortunately, this leaves me with a rather slow implementation. To generate all primes below 2 million it takes about 8 seconds on a 3Ghz Intel chip.
Is there anyway to improve the execution time of thi...
I'm working on a thing where I want to have the output option to go to a video overlay. Some support rgb565, If so sweet, just copy the data across.
If not I have to copy data across with a conversion and it's a frame buffer at a time. I'm going to try a few things, but I thought this might be one of those things that optimisers w...
Currently, I'm opening a database connection in my app's initialization. It's a fairly small app, PHP if that's relevant.
Should I be connecting to the database, making calls, then closing and repeating this process for each database function I write?
For example, I have the following function which grabs the $db variable from my app's...
Hi,
there are a lot of mobile devices that can surf and could benefit from a website optimiezed for their screen resolution and so on.
but how do you decide which device to support, because you can't support all of them with an optimized mobile page view.
my way would be to do a sum-up mobile page, that most of the devices can handle, ...
We know that compilers are getting better and better at optimising our code and make it run faster, but my question are there compilers that can optimise floating point operations to ensure greater accuracy.
For example a basic rule is to perform multiplications before addition, this is because multiplication and division using floating...
I found this on an "interview questions" site and have been pondering it for a couple of days. I will keep churning, but am interested what you guys think
"10 Gbytes of 32-bit numbers on a magnetic tape, all there from 0 to 10G in random order. You have 64 32 bit words of memory available: design an algorithm to check that each number f...
I would like to select the compiler optimizations to generate the fastest possible application.
Which of the following settings should I set to true?
Dead store elimination
Eliminate duplicate expressions within basic blocks and functions
Enable loop induction variable and strength reduction
Enable pentium instruction scheduling
Expan...
Given a scenario where there are millions of potentially overlapping bounding boxes of variable sizes less the 5km in width.
Create a fast function with the arguments findIntersections(Longitude,Latitude,Radius) and the output is a list of those bounding boxes ids where each bounding box origin is inside the perimeter of the function ar...
Some PNG images although just 150px x 160px wide have 60KB filesize. I've already run them though optimizers (ImageOptim for Mac) but that didn't help much.
Is there any way to compress it further, either manually or using some other tool? 60KB for a normal 150x160 image is really unacceptable and I can't use JPG or GIF there because I...
The iphone app I am developing in landscape mode is seriously chugging. I put it in portrait for comparison and it appears to run much smoother in that orientation. I am not doing what I'd think is process intensive: a map view, some buttons, some labels, and some quartz drawing, yet some basic quartz animation seriously slows down rea...