Hello,
With these two questions as background (first and second), I got curious about how much optimization a C++ compiler can perform when dealing with pointers? More specifically, I'm interested in how smart a compiler is when it optimizes away code which it may detect will never be run.
(Some may point out that this is a dupe of thi...
The actual question goes like this:
McDonald's is planning to open a number of joints (say n) along a straight highway. These joints require warehouses to store their food. A warehouse can store food for any number of joints, but has to be located at one of the joints only. McD has a limited number of warehouses (say k) available, and w...
Hello,
When can optimizations done by the compiler cause my C++ code to exhibit wrong behaviour which would not be present had those optimizations not been performed? For example, not using volatile in certain circumstances can cause the program to behave incorrectly (e.g. not re-reading the value of a variable from memory and instead o...
I've read some of posts here about png/jpg/gif but still I'm quite confused..
I've got a big header on my website :
width:850px height:380px weight:108kb
And it's jpg. A woman + gradient + some layers on top and behing her..
Do you think 108kb it's too much? I was thinking about cut it to png pieces..Would that be a bad idea? What's y...
A user has a few Lookup selections on a JSP page. After he's selected what data he wants exported, the JSP calls my servlet which should do something like this:
get request data
generate SQL for the request data
execute the SQL and write it to a XML file
package the XML file to a ZIP file and return it as a response
Now, the first tw...
Hi guys, hoping you can help me on the right track to start optimising my queries. I've never thought too much about optimisation before, but I have a few queries similar to the one below and want to start concentrating on improving their efficiency. An example of a query which I badly need to optimise is as follows:
SELECT COUNT(*) AS ...
I have a simple service that does approximately the following:
An HTTP client connects to the server
The server writes the sessionID of the client and the timestamp to the database, and in most cases just returns an empty response
(The cases when it does do real work and return actual data are irrelevant to this question)
In order t...
I'm writing a snake game in TI-Basic, and every time I move I need to see if the head of the snake has hit any point in the tail. The tail is stored as a circular list-based queue, and I can add the beginning and end in constant time.
The only hard part is that I have to do something similar to this on every iteration:
(S = Size of the ...
I think this is just a matter of fine tuning some different elements, but I'd like to know your take. I've got a Flex app, using the Flex 4 data services, communicating with Zend AMF services. One of the services returns all the results in a database using SELECT * FROM table there are ~1200 rows (140KB package size).
My problem is the ...
Basically, I want an array of ids from the database.
Some background:
I'm rendering a list of objets (foos) to the user with a checkbox.
If the user checks the box a row is create in a different table (bar)
when rendering the foo list + checkbox I want to check if the unique id any given foo already exists in the bar id array.
I ...
Hello, I'm writing a model-checker which relies on the computation of a coefficient which is used intensively by the algorithms which is the following:
where q is double, t a double too and k an int. e stands for exponential function. This coefficient is used in steps in which q and t don't change while k always starts from 0 until th...
I'm using OpenGL ES 1.1 to render a large view in an iPhone app. I have a "screenshot"/"save" function, which basically creates a new GL context offscreen, and then takes exactly the same geometry and renders it to the offscreen context. This produces the expected result.
Yet for reasons I don't understand, the amount of time (measured ...
Hi everyone,
I added .resx files to my project and everything works ok. I can access my .resx files in the code by typing ApplicationName.resourcename which is quite nice, instead of calling resourceManager.getString(blabla).
However I would like to have a structure, to access resources like:
ApplicationName.Resources.Buttons.btnreso...
I'm trying to write a small script which parses and executes Brainfuck code, to understand the GHC options of optimization, I'm trying to optimize the code in order to be a bit faster and to understand what's going on there.
On of the parts is the internal represantation of BF-code, I use a special datatype for this. Here's the sourceco...
Here I have a query like below:
SELECT field
FROM table
WHERE value IN ('val1', 'val2', 'val3', ... 'valn')
Let's say there are 2000 values inside the IN clause, the value doesn't exist in other table. Do you have any idea to speed up this operation?
The question is open to accept any kind of methods..
Thanks!
...
Here are signatures.
glUniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
glUniform4fv(GLint location, GLsizei count, const GLfloat *v);
In my humble opinion, former should be faster because values can be passed directly from registers without fetching from memory. However, I want to hear many opinions.
...
I have the following query:
SELECT
`pokemon_moves`.`pokemon_move_method_id`,
`pokemon_moves`.`level`,
`move`.`id`,
`move`.`name`
FROM
`pokemon_moves`
LEFT OUTER JOIN
`moves` `move` ON
`move`.`id` = `pokemon_moves`.`move_id`
WHERE
`pokemon_moves`.`pokemon_move_method_id` < '4' AND
`pokemon_moves`.`...
I am making a game for windows, mac and GNU, I can built it on windows already with MSVC and MingW...
But I am not finding good information regarding how much compilers optmize.
So what compiler, and options on that compiler, I can use to make my Windows version blazing fast?
Currently the profilers are showing some worring results l...
Yes, I am using a profiler (ANTS). But at the micro-level it cannot tell you how to fix your problem. And I'm at a microoptimization stage right now. For example, I was profiling this:
for (int x = 0; x < Width; x++)
{
for (int y = 0; y < Height; y++)
{
packedCells.Add(Data[x, y].HasCar);
packedCells.Add(Data[x, ...
I'm not sure if this is possible but here we go. I'm building an email module for my application. Basically it refers to an inbox on a mail server, it retrieves all headers of the emails and the details periodically.
The thing I've noticed is that the connection to email itself takes a while i.e 3-5 seconds of waiting time and a connect...