optimization

Measure website

Hi, I was wondering if it is possible to install or use any online service to measure your website's performance? I've seen many just checking the download speed of images, external files etc. But is it possible to meassure how long asp/php code takes to execute? I have a site running a bit slowly, and it would be very nice with some a...

Mysql slow query: INNER JOIN + ORDER BY causes filesort

Hello! I'm trying to optimize this query: SELECT `posts`.* FROM `posts` INNER JOIN `posts_tags` ON `posts`.id = `posts_tags`.post_id WHERE (((`posts_tags`.tag_id = 1))) ORDER BY posts.created_at DESC; The size of tables is 38k rows, and 31k and mysql uses "filesort" so it gets pretty slow. I tried to use different ...

Why are my column sorts slow in Django Admin, only 1 problem table

I have a table (MySQL) with 10K+ records. Not a huge table. When working with the table in Django's Admin, the default sort order, the page loads blazing fast. Hardly noticeable. But if I attempt to sort by any column, say by ID column or even a date column, it can take over a minute to return results. Other tables work fine Any c...

How can I inprove this function under CUDA?

Hi, I can inprove this function under CUDA? What this function does is: Given a min and max, ELM1 and ELM, check if any three numbers of array ans[6] are found in any row, from min to max, in array D1,D2,D3,D4,D5,D6, if found return 1 I tried any other way, like looping, or-ing, and-ing, replacing goto with flag etc. etc. but this se...

Benchmarking a particular method in Objective-C

I have a critical method in an Objective-C application that I need to optimize as much as possible. I first need to take some easy benchmarks on this one single method so I can compare my progress as I optimize. What is the easiest way to track the execution time of a given method in, say, milliseconds, and print that to console. ...

Is it faster to construct jQuery objects using method syntax or pure html?

Using jQuery what provides for faster object construction: With the HTML code $('<dd class="foo baz" id="bar"> foobar </dd>') Or with the pure object/method variant $('</dd>').addClass('foo').addClass('baz').id('bar').text('foobar') I'm not sure how the internals work, feel free to supply a high level summary. ...

Python tips for memory optimization

Hi all, I need to optimize the RAM usage of my application. PLEASE spare me the lectures telling me I shouldn't care about memory when coding Python. I have a memory problem because I use very large default-dictionaries (yes, I also want to be fast). My current memory consumption is 350MB and growing. I already cannot use shared hosting...

Nodes set of the same type with if-test. Make it less.

How to make the code more beautiful (compact)? <xsl:template match="part"> <table class="part"> <xsl:if test="name != ''"> <tr> <td>Название</td><td><xsl:value-of select="name"/></td> </tr> </xsl:if> <xsl:if test="model != ''"> <tr> <td>Модел...

Open space sitting optimization algorithm

As a result of changes in the company, we have to rearrange our sitting plan: one room with 10 desks in it. Some desks are more popular than others for number of reasons. One solution would be to draw a desk number from a hat. We think there is a better way to do it. We have 10 desks and 10 people. Lets give every person in this contest...

Seeking free ODBC database optimization tool for non-experts

I'm a database n00b and am reading as many books as I can. I have been given responsibility for an ODBC tool where the databases were designed by a hardware engineer with some VB experience - which made him a s/w guru in the small firm at that time. Things are running slowly and I suspect that the db could have been designed better. I ...

Is it correct to use Array.CopyTo to copy elements or should a for-loop always be used?

It's easier to write intArray1.CopyTo( intArray2, 0 ) than the for-loop equivalent, but System.Array does not provide any generic Copy/CopyTo methods. Is it better to write the for-loop? Or is using Copy/CopyTo compiled or JIT'd efficiently enough? ...

Efficient algorithm for creating an ideal distribution of groups into containers with potential overflow?

I have groups of students that need to be allocated into classrooms of a fixed capacity (say, 100 chairs in each). Each group must only be allocated to a single classroom, even if it is larger than the capacity (ie there can be an overflow, with students standing up) I need an algorithm to make the allocations with minimum overflows an...

File IO with Streams - Best Memory Buffer Size

I am writing a small IO library to assist with a larger (hobby) project. A part of this library performs various functions on a file, which is read / written via the FileStream object. On each StreamReader.Read(...) pass, I fire off an event which will be used in the main app to display progress information. The processing that goes on i...

Fast format conversion open source library

Can someone advise me open source format conversion library? Optimized for SSE, SSE2. Formats for conversion: I420, YUY2, RGB(16-bit, 32-bit). I found only VirtualDub Kasumi library. ...

Most flexible minimizer/compressor for ASP.NET MVC 2?

From your experience, what's the most flexible minimizer/compressor (JS+CSS) for ASP.NET MVC you've dealt with? So far mbcompress doesn't seem to be too MVC friendly weboptimizer.codeplex.com lacks documentation clientdependency.codeplex.com is still in beta compress2 seems like a good candidate, but haven't tried it yet mvcscriptmana...

Please help me optimize my Python code

Beginner here! Forgive me in advance for raising what is probably an incredibly simple problem. I've been trying to put together a Python script that runs multiple find-and-replace actions and a few similar things on a specified plain-text file. It works, but from a programming perspective I doubt it works well. How would I best go abou...

prevent using functions before initialization, constructors-like in C

This is the way I get to prevent funA,funB,funC, etc.. for being used before init #define INIT_KEY 0xC0DE //any number except 0, is ok static int initialized=0; int Init() { //many init task initialized=INIT_KEY; } int funA() { if (initialized!=INIT_KEY) return 1; //.. } int funB() { if (initialized!=INIT_KEY) return 1; //....

How to optimize my PostgreSQL DB for prefix search?

I have a table called "nodes" with roughly 1.7 million rows in my PostgreSQL db =#\d nodes Table "public.nodes" Column | Type | Modifiers --------+------------------------+----------- id | integer | not null title | character varying(256) | score | double precision | Indexe...

Fastest way to put contents of Set<String> to a single String with words separated by a whitespace?

I have a few Set<String>s and want to transform each of these into a single String where each element of the original Set is separated by a whitespace " ". A naive first approach is doing it like this Set<String> set_1; Set<String> set_2; StringBuilder builder = new StringBuilder(); for (String str : set_1) { builder.append(str).appe...

genStrAsCharArray optimisation benefits

Hi I am looking into the options available to me for optimising the performance of JBoss 5.1.0. One of the options I am looking at is setting genStrAsCharArray to true in <JBOSS_HOME>/server/<PROFILE>/deployers/jbossweb.deployer/web.xml. This affects the generation of .java code from .JSPs. The comment describes this flag as: Shou...