I'm working on this game titled "Fortress", located at http://www.joemajewski.com/fortress. Anyways, it's one of those browser-based role-playing games where players build an army and upgrade their stats to get a high ranking on the leaderboard.
Every 30 minutes a cron job is going to execute, which makes some updates. It loops through ...
What's the fastest/cleanest way to find the bit offset of the first unset bit in an array of arbitrary length?
Assume the prototype for your function is something like this size_t first_unset_bit(char unsigned const *buf, size_t bit_count, size_t start_bit); and that it may be called several times in quick succession on the same buffer....
I have been hearing a lot about Project Euler so I thought I solve one of the problems in C#. The problem as stated on the website is as follows:
If we list all the natural numbers
below 10 that are multiples of 3 or 5,
we get 3, 5, 6 and 9. The sum of these
multiples is 23.
Find the sum of all the multiples of 3
or 5 be...
There is an action in the admin section of a client's site, say Admin::Analytics (that I did not build but have to maintain) that compiles site usage analytics by performing a couple dozen, rather intensive database queries. This functionality has always been a bottleneck to application performance whenever the analytics report is being...
Is there any way you can speed up XSL transformations? I am using the XSLCompiledTransform class to transform my XML files. My XML files contain around 3900 records with roughly 100 fields within each record. The transformation file for this is around 10 KB in size.
It takes about 25 - 30 minutes before I see the transformed file.
I a...
any pointers on what must not be in an awk script? I am asking as I dont find any tool to debug an awk script. I have a script taking a lot of cpu so need to know if I am doing something terribly wrong with the script.
Just for an example, I keep looking for output of a logfile via 'tail -f filename' till my script gets killed.
...
I have written a small WinForm application in C#. The EXE that is made is 74 Kb and all together with the resources and all it sizes 179 Kb. But when I run it, it takes 9.1 MBs in memory according to Task Manager.
So my question is:
Why is it happening?
What can I do to reduce the size of this?
If the size could be reduced how much r...
Suppose you've written a portable C++ code which runs smoothly on different platforms. To make some modifications to optimize performance, you use inline assembly inside your code. Is it a good practice (compiler optimization set aside) or will it make troubles for portability?
...
Hello,
I have a very specific query. I tried lots of ways but i couldn't reach the performance i want.
SELECT *
FROM
items
WHERE
user_id=1
AND
(item_start < 20000 AND item_end > 30000)
i created and index on user_id, item_start, item_end
this didn't work and i dropped all indexes and create new indexes
user_id, (item_sta...
I have an undirected unweighted graph G = (V, E) and a randomly chosen subset S of its vertices. I want to check whether the vertices in S are mutually adjacent (i.e. form a complete subgraph/a clique).
I have the following algorithm (pseudo-code):
foreach vertex in S {
// Check that the vertex has enough edges
if (vertex.edges.cou...
Hey everyone,
I've been having my fun with Project Euler challenges again and I've noticed that my solution for number 12 is one of my slowest at ~593.275 ms per runthrough. This is second to my solution for number 10 at ~1254.593 ms per runthrough. All of my other answers take less than 3 ms to run with most well under 1 ms.
My Java s...
I am creating an app with a WPF frontend and a PostgreSQL database. The data includes patient addresses and supplier addresses. There is an average of about 3 contacts per mailing address listed. I'm estimating 10,000 - 15,000 contact records per database.
When designing the database structure, it occurred to me that rather than storing...
I have a simple program which reads a bunch of things from the filesystem, filters the results , and prints them. This simple program implements a domain specific language to make selection easier. This DSL "compiles" down into an execution plan that looks like this (Input was C:\Windows\System32\* OR -md5"ABCDEFG" OR -tf):
Index Succe...
Hello SQL Server engine experts; please share with us a bit of your insight...
As I understand it, INCLUDE columns on a non-clustered index allow additional, non-key data to be stored with the index pages.
I am well aware of the performance benefits a clustered index has over a non-clustered index simply due to the 1 fewer step the eng...
Does the java compiler (the default javac that comes in JDK1.6.0_21) optimize code to prevent the same method from being called with the same arguments over and over? If I wrote this code:
public class FooBar {
public static void main(String[] args) {
foo(bar);
foo(bar);
foo(bar);
}
}
Would the method f...
Suppose we have a loop that runs for 100 times. Does using unsigned char instead of int for its counter make a difference? And also using i += 1U instead of i++? Or do compilers take care of that?
...
Hello world!
I am wondering if it is possible to render a scene to multiple render targets in a single pass (or anything faster than drawing it several times through client code). I want to optimize some code that is being rendered to several textures of varying dimensions (512 by 512, 256 by 256, 128 by 128 and 64 by 64 for example).
...
float mixValue = ... //in range -1.0f to 1.0f
for(... ; ... ; ... ) //long loop
{
float inputLevel = ... //in range -1.0f to 1.0f
if(inputLevel < 0.0 && mixValue < 0.0)
{
mixValue = (mixValue + inputLevel) + (mixValue*inputLevel);
}
else
{
mixValue = (mixValue + inputLevel) - (mixValue*inputLevel)...
jQuery is currently providing me with a fun introduction to Javascript after 12 years of surviving happily without. I'm at the stage where I'm trying to learn as much as I can about optimising the code I write and, whilst I have found plenty of good reference material, there is something quite basic which is puzzling me and I have been u...
Hi,
I'm using Visual Studio C++ 2010 Express. I made this function with variable argument list:
BOOL Send(SOCKADDR_IN toAddr, LPTSTR command, LPTSTR first, ...) {
if (g_udpSocket == INVALID_SOCKET || command == NULL)
return FALSE;
va_list args;
va_start(args, command);
LPTSTR str = va_arg(args, LPTSTR);
TCHAR szData[DEFAULT_ST...