performance

How to not over-use jQuery?

Typical jQuery over-use: $('button').click(function() { alert('Button clicked: ' + $(this).attr('id')); }); Which can be simplified to: $('button').click(function() { alert('Button clicked: ' + this.id); }); Which is way faster. Can you give me any more examples of similar jQuery over-use? ...

Making the Android emulator run faster

The Android emulator is a bit sluggish. For some devices, like the Motorola Droid and the Nexus One, the app runs faster in the actual device than the emulator. This is a problem when testing games and visual effects. How do you make the emulator run as fast as possible? I've been toying with its parameters but haven't found a configura...

'echo' or drop out of 'programming' write HTML then start PHP code again

For the most part, when I want to display some HTML code to be actually rendered I would use a 'close PHP' tag, write the HTML, then open the PHP again. eg <?php // some php code ?> <p>HTML that I want displayed</p> <?php // more php code ?> But I have seen lots of people who would just use echo instead, so they would have done the ab...

Flex preload states

Is it possible to preload the states? So that while a user is browsing say state1, state2 and state3 are loading. ...

Windows Mobile 6 / 6.5 performance monitoring

I'm writing an app for a Pocket PC device which appears to be slowly leaking resources - after 24hrs the device slowly becomes unresponsive and eventually locks up altogether. On XP/Vista I would at this point fire up trusty PerfMon and plot graphs of handles, threads, memory, mutexes etc - anything that could be leaking. Can someon...

How optimize queries with fully qualified names in t-sql?

When I call: select * from Database.dbo.Table where NAME = 'cat' It takes: 200 ms And when I change database to Database in Management Studio and call it without fully qualified name it's much faster: select * from Table where NAME = 'cat' It takes: 17 ms Is there any way to make fully qualified queries faster without changing ...

Is regex too slow? Real life examples where simple non-regex alternative is better

I've seen people here made comments like "regex is too slow!", or "why would you do something so simple using regex!" (and then present a 10+ lines alternative instead), etc. I haven't really used regex in industrial setting, so I'm curious if there are applications where regex is demonstratably just too slow, AND where a simple non-reg...

Will fixed-point arithmetic be worth my trouble?

I'm working on a fluid dynamics Navier-Stokes solver that should run in real time. Hence, performance is important. Right now, I'm looking at a number of tight loops that each account for a significant fraction of the execution time: there is no single bottleneck. Most of these loops do some floating-point arithmetic, but there's a lot ...

Suggestion on Database structure for relational data

Hi there. I've been wrestling with this problem for quite a while now and the automatic mails with 'Slow Query' warnings are still popping in. Basically, I have Blogs with a corresponding table as well as a table that keeps track of how many times each Blog has been viewed. This last table has a huge amount of records since this page i...

SQL Performance Question (no where clause vs where column like '%')

Hi, in a query, is there any performance hit by doing a where clause like so select bunchofstuff from sometable where column like '%' vs select bunchofstuff from sometable Building some dynamic queries, just curious. Thanks. ...

Linq-to-sql Add item and a one-to-many record at once

I have a function where I can add articles and users can comment on them. This is done with a one to many relationship like= "commentId=>ArticleId". However when I try to add the comment to the database at the same time as I add the one to many record, the commentId is not known. Like this code: Comment comment = new Comment(); comment....

PHP fastest method of reading server response

Hi there, im having some real problems with the lag produced by using fgets to grab the server's response to some batch database calls im making. Im sending through a batch of say, 10,000 calls and ive tracked the lag down to fgets causing the hold up in the speed of my application as the response for each call needs to be grabbed. I ...

Drawing performance in Java 6 updates 19,20 versus Java 6 update 3 ?

I'm getting twice the frame rate with the earlier Java 6 u 3, than with the new ones. Very weird. Can anyone give some explanation? On Core 2 Duo 1.83ghz, integrated video (only one core is used) - 1500 (older java) vs 700 fps On Athlon 64 3500+, discrete video - 120 (older java) vs 55 fps The app is a simple game with a moving rectang...

How Can I Improve/SpeedUp This FrequentFunction in C?

Hi folks, How can I improve / speed up this frequent function? #include <math.h> #include <stdio.h> #include <stdlib.h> #include <time.h> #define M 10 // This is fixed #define N 8 // This is NOT fixed // Assumptions: 1. x, a, b and c are all arrays of 10 (M). // 2. y and z are all matrices of 8 x 10 (N x M). // Requirem...

integer division in php

hi guys, i'm looking for the fastest way to do an integer division in php. for example, 5 / 2 schould be 2 | 6 / 2 should be 3 and so on. if i simply do this, php will return 2.5 in the first case, the only solution i could find was using intval($my_number/2) - wich isn't as fast as i want it to be (but gives the expected results). can...

How to display many SVGs in Java with high performance

What I want My goal is to be able to display a large number of SVG images on a single drawing area in Java, each with its own translation/rotation/scale values. I'm looking for the simplest solution allowing this, optionally even using OpenGL to speed things up. What I've Tried My initial naive approach was to use SVGSalamander to dra...

2k rows update is very slow in MySQL

Hi all, I have 2 tables: 1. news (450k rows) 2. news_tags (3m rows) There are some triggers on news table update which updating listings. This SQL executes too long... UPDATE news SET news_category = some_number WHERE news_id IN (SELECT news_id FROM news_tags WHERE tag_id = some_number); #about 3k ...

Fastest possible way to render 480 x 320 background as iPhone OpenGL ES textures

I need to display 480 x 320 background image in OpenGL ES. The thing is I experienced a bit of a slow down in iPhone when I use 512 x 512 texture size. So I am finding an optimum case for rendering iPhone resolution size background in OpenGL ES. How should I slice the background in this case to obtain the best possible performance? My ma...

Performance concern when using LINQ "everywhere"?

After upgrading to ReSharper5 it gives me even more useful tips on code improvements. One I see everywhere now is a tip to replace foreach-statements with LINQ queries. Take this example: private Ninja FindNinjaById(int ninjaId) { foreach (var ninja in Ninjas) { if (ninja.Id == ninjaId) return ninja; } ...

Speeding up CakePHP

I've been a keen fan and user of CakePHP for about 2.5 years now, but the main bugbear that most fellow developers level at the framework is that it's slow, and the dispatch cycle takes too long to make it a viable solution for production environments. I'm hoping that this question will inspire people to share their tips, tricks and hac...