My program is fast enough, but I'd rather give up that speed for memory optimization since one user's maximum memory usage goes up to 300 MB meaning few of them could constantly crash the application. Most of the answers I found were related to speed optimization, and other were just general ("if you write directly from a database to mem...
I have 10k forum topics. I run this query:
SELECT *
FROM `topics`
WHERE category_id = '2'
ORDER BY `last_message` DESC
LIMIT 2990, 10
This checks all rows! All rows! Even after adding index to last_message. last_message is a time() and I want to order all messages by that descending. So, what do you suggest me? Without...
I am developing a website exclusively for mobile browsers.
What guidelines should I follow to optimize the site for mobile development?
My main concerns:
Most mobile devices have propriety browsers. How can the app be tested on those different browsers (testing on an actual device is not possible due to security restrictions)?
How to o...
Hi
For fast MTF ( http://en.wikipedia.org/wiki/Move-to-front_transform ) i need faster version of moving a char from inside the array into the front of it:
char mtfSymbol[256], front;
char i;
for(;;) { \\ a very big loop
...
i=get_i(); \\ i is in 0..256 but more likely to be smaller.
front=mtfSymbol[i];
memmove(mtfS...
One of the guys here at work puts the tag name in front of all his CSS selectors for element ids. For example:
div#footer {
}
This, as opposed to just:
#footer {
}
His rationale is that this is a quicker lookup for most browsers because they don't need to check the id attributes of every type of element--just div elements. He als...
As a programmer I use to follow TDD, beginning by writing a simple version of my code then heavily refactoring it. When refactoring I usually just listen to my code. I search for bad smells and then refactor the code to remove smells. Typically I will introduce new methods to avoid repeating code, move class members around to put them ne...
Not sure how to word the question concisely :).
I have say 20 Posts per page, and each Post has 3-5 tags. If I show all the tags in the sidebar (Tag.all.each...), then is there any way to have a call to post.tags not query the database and just use the tags found from Tag.all?
class Post < ActiveRecord::Base
end
class Tag < ActiveRe...
I have a multisite Drupal installation with about 20 urls pointing to the same code base and a common database. I have around 20,000 visitors visiting all sites daily which I hope would increase.
I am using 2 servers currently- one being the webserver Apache 2 on Linux Platform and the other is the database server- MYSQL.
Offlate my MY...
I have a program that is running slower than I'd like it to.
I've done some profiling, and I've found the section that is taking up the vast majority of processing time
DO K = 0, K_MAX
WRITE(EIGENVALUES_IO, *) K * 0.001 * PI, (W_UP(J), J=1, ATOM_COUNT)
DCMPLXW_UP(:) = DCMPLX(W_UP(:))
DO E = ...
I've been doing a lot of research, reading on replication, etc but just not sure as to what mysql solution would work.
This is what I'm looking at:
when my mysql fails for some reason or there are certain queries that are taking really long to execute and locking some tables, I want the other insert/update/select queries to still func...
I've been teaching myself Python at my new job, and really enjoying the language. I've written a short class to do some basic data manipulation, and I'm pretty confident about it.
But old habits from my structured/modular programming days are hard to break, and I know there must be a better way to write this. So, I was wondering if any...
Hello,
I would like to know if there is a way to avoid processing some objects in a away3DLite scene. The problem is that I Have a scene with a lot of spheres, some of them are not visible ( out of camera range ) and I would like not to processing them.
Maybe Away3D automatically does that.
Maybe visible = false can help
Any good tut...
I have just converted my application from LINQ2SQL to NHibernate and I'm trying to figure out how to optimise the following example. I tried using the .Future method but when my session closes the view then tries to fetch the data and I get a session closed error.
Does anyone know any best practises for this kind of thing? I have a lot ...
Is it possable to optimize this query?
SELECT count(locId) AS antal , locId
FROM `geolitecity_block`
WHERE (1835880985>= startIpNum AND 1835880985 <= endIpNum)
OR (1836875969>= startIpNum AND 1836875969 <= endIpNum)
OR (1836878754>= startIpNum AND 1836878754 <= endIpNum)
...
...
OR (1843488110>= startIpNum AND 1843488110 ...
In my Android app I want to have an input field with autocomplete. The number of items will be about 300000. The best solution seems to be to put the items into a file (on sdcard), one item per line, each line would have the same number of characters so that I can seek to specific line number. If the user enters something in the text fie...
I was reading the transcription of Steve Yegge's Dynamic Languages Strike Back presentation, when I noticed this comment when he begins to discuss trace trees:
I'll be honest with you, I actually have two optimizations that couldn't go into this talk that are even cooler than this because they haven't published yet. And I didn't want...
If I have a Boolean expression to check
(A && B)
If A is found to be false will the language bother to check B? Does this vary from language to language?
The reason I ask is that I'm wondering if it's the case that B is checked even if A is false then wouldn't
if (A) {
if(B) {
} else {
// code x
}
} else {
// code x
}...
Here is the log output:
# Time: 100915 13:06:49
# User@Host: ss[ss] @ localhost []
# Query_time: 13.978355 Lock_time: 0.000029 Rows_sent: 10 Rows_examined: 562760
use ss;
SET timestamp=1284574009;
SELECT DISTINCT
SQL_CALC_FOUND_ROWS
B.*,
U.username
FROM sc_users AS U,
sc_bookmarks AS B ...
I found that a neat way to convert an array-like object (e.g. NodeList, Arguments) into a real array is to use:
Array.prototype.slice.call(...);
Then, I thought of a way to shorten this syntax:
[].slice.call(...);
Would the latter method waste time and/or memory by creating a new array each time that it is called? Should I avoid th...
Hi there, I would like to know if performing a logical right shift is faster when shifting by a power of 2. I am using C++.
For example, is
myUnsigned >> 4
any faster than
myUnsigned >> 3
I appreciate that everyone's first response will be to tell me that one shouldn't worry about tiny little things like this, it's using correct a...