I see a lot of c++ code that looks like this:
for( const_iterator it = list.begin(),
const_iterator ite = list.end();
it != ite; ++it)
As opposed to the more concise version:
for( const_iterator it = list.begin();
it != list.end(); ++it)
Will there be any difference in speed between these two conventions? Naively the...
I am just starting with g++ compiler on LINUX and got some questions on the compiler flags. Here are they
Optimizations
I read about optimization flags -O1,-O2 and -O3 in the g++ manual page. I didn't understood when to use these flags. Usually what optimization level do you use? g++ manual says the following for -O2.
Optimize even...
I'm developing a windows application in C# using VS2005.
Consider i need to call a non static method(Method1) which is in a class(Class1) from another class(Class2). In order to call the method, i need to create object for that class.
But my class 'Class1' has more than 1000 variables. So every time i create object for 'Class1', all the...
Consider a web application that resizes large tiff files on the fly. Each large tiff file is resized into a jpg thumbnail and larger jpg when the user invokes the operation. The dimensions of these converted files is always the same.
During a code review yesterday, one of the other developers asked me why I set those dimensions in my gl...
I have a high score database for a game that tracks every play in a variety of worlds. What I want to do is find out some statistics on the plays, and then find where each world "ranks" according to each other world (sorted by number of times played).
So far I've got all my statistics working fine, however I've run into a problem findin...
Duplicate: Multiple javascript/css files: best practices?
Hi guys, my application is almost done but the thing is that I've noticed that I'm including a lot of external javascript files and css. I'm using a lot of third party free plugins here and didnt want to touch the code for fear of messing something up.
But the result is that I n...
Hello,
I have List collection with around 35,000 strings
Typical string looks like this:
"<i>füüs</i>ampri tähis;lüh ld-st<i>anno</i>, aastal;<i>maj</i> lüh pr-st<i>argent</i>, raha (kursisedelitel)"
Basically this string contains bunch of words in Estonian :)
I need to allow user to perform RegExp search on 35,000 strings
If I pe...
So, I have a database that is 80MB uncompressed. I've gz'd it to 30MB, but it now requires a 25 second "unpack" time when the application first launches. I've written this code in C, making it as fast as possible (no NS* types, minimal code to complete the read from the gz to the write of the new .db).
Here's a bit of data on the sizes ...
Following on Steve (YSlow) Souder's evangelism, my site (LibraryThing.com) splits requests across domains to facilitate parallel loading. We do CSS, JS and images; you can also do Flash, etc. We also use Google's version of Prototype, which is cross-domain, not just cross-subdomain.
This is all great for speed, but for a small percent o...
I've seen some methods like this:
void SomeClass::someMethod() const;
What does this const declaration do, and how can it help optimize a program?
Edit
I see that the first part of this question has been asked before... BUT, it still doesn't answer the second part: how would this optimize the program?
...
I have a string that may have whitespace characters around it and I want to check to see whether it is essentially empty.
There are quite a few ways to do this:
1 if (myString.Trim().Length == 0)
2 if (myString.Trim() == "")
3 if (myString.Trim().Equals(""))
4 if (myString.Trim() == String.Empty)
5 if (myString.Trim().Equals(Strin...
This is the well know select algorithm. see http://en.wikipedia.org/wiki/Selection_algorithm.
I need it to find the median value of a set of 3x3x3 voxel values. Since the volume is made of a billion voxels and the algorithm is recursive, it better be a little bit fast.
In general it can be expected that values are relatively close.
Th...
I have a such fuctions for Jquery:
$("input").focus(function () {
$(this).addClass('focus');
});
$("input").blur(function () {
$(this).removeClass('focus');
});
$("select").focus(function () {
$(this).addClass('focus');
});
$("select").blur(function () {
$(this).removeClass('focus');
});
$("textarea").focus(function ()...
how can i reduce the file size of my flex application. its around 900kb .
...
I'm working on some existing c++ code that appears to be written poorly, and is very frequently called. I'm wondering if I should spend time changing it, or if the compiler is already optimizing the problem away.
I'm using Visual Studio 2008.
Here is an example:
void someDrawingFunction(....)
{
GetContext().DrawSomething(...);
Ge...
1 set:
$('#tabs li:first-child').addClass('first-child');
$('.photos li:first-child').addClass('first-child');
$('#alphabet li:first-child').addClass('first-child');
2 set:
$(function(){
$("#header-thumbs img").fadeTo("fast",1);
$("#header-thumbs img").hover(function(){
$(this).fadeTo("fast",.7)},function(){
$(th...
I'm currently using CGContextDrawLayerInRect to draw a CGLayer in drawRect. This is called quite often. Is there any way to lessen the overhead by drawing only that part of the CGLayer which has changed instead of the whole CGLayer in drawRect?
-(void)drawRect:(CGRect)rect {
CGContextRef currentContext = UIGraphicsGetCurrentContext(...
I need to draw peak meters for audio in realtime. Minimum 44100 samples per second times a minimum 40 streams. Each buffer is between 64 and 1024 samples. I need to grab the abs max from each buffer. (These are then fed through a kind of lowpass filter and drawn at about 20ms intervals.)
for(int i = 0; i < numSamples; i++)
{
absM...
I am creating an online calendar for a client using PHP/MySQL.
I initiated a <table> and <tr>, and after that have a while loop that creates a new <td> for each day, up to the max number of days in the month.
The line after the <td>, PHP searches a MySQL database for any events that occur on that day by comparing the value of $i (the c...
I have an input PDF file (usually, but not always generated by pdfTeX), which I want to convert to an output PDF, which is visually equivalent (no matter the resolution), it has the same metadata (Unicode text info, hyperlinks, outlines etc.), but the file size is as small as possible.
I know about the following methods:
java -cp Mult...