optimization

Browser behavior with huge doms

Can anyone speak to how the different browsers handle the following: Picture an HTML document essentially rendering content of a static app with lots of data. <div class="abundant_class"> <div class="abundant_class"> <div class="abundant_class"></div> <div class="abundant_class"></div> ... </div> ...

further optimizing NHibernate CreateMultiQuery usage for eager fetching

CreateMultiQuery is recommended when we want to eagerly load entity with its subentities with a single roundtrip - less columns returned as we don't have X*Y*Z*T but rather X, X*Y, X*Z, X*T. This is working well for me, but it's not optimal as if X is a table with many columns, I pull a lot of data from the DB. example: const string que...

optimising aggregates with and without a condition in ms sql

Hi, I would like to get a sum from a column, with and without a condition. The code I have now is SELECT regular.id, regular.sum as regularsum, special.sum as specialsum FROM (SELECT Sum(stuff) as sum, id FROM table WHERE commonCondition = true GROUP BY id) as regular INNER JOIN (SELECT Sum(stuff) as sum, id FROM table Where commo...

Microsoft Visual C++ code optimization

In MSVC, there are four options for code optimization: No Optimization Minimize Size Maximize Speed Full Optimization The first three are self-explanatory, but I am unsure about Full Optimization. Does this try to find a balance between size and speed, or does it do better optimization than the other two options? Please clarify what ...

R - optimize objective function (does lots of matrix manipulation)

This is (the greatest part of) the cost function for a genetic optimization, so it needs to be really fast. Right now it's painfully slow even for toy problem sizes. I'm pretty sure there are faster ways to do many of the operations in this code, but I'm not that good at tuning R code. Can anyone suggest anything? Fb, Ft, and Fi are ...

How to validate if there was 12 sequential payments

As example : I have this scenario where we receive payments, a singular payment per family, and register those payments with it's amount in the DB. The thing is that a family can move their loan from bank1 to bank2, only if they have 12 or more sequential payments. As example if they have registered a payment for oct, nov, dec, jan, ...

Simplex solver Library Help

Hi I have to migrate some old code which used the c based LPPSolver library to solve a Simplex problem. My problem in Java is to find anon commercial JAVA based solver which can handle large number of variables. I have tried the Apache SimplexSolver. But in most of my cases I get not feasible solution. Please help. Thanks ...

How to print line numbers for textbox in c#

This is going to be a long post. I would like to have suggestions if any on the procedure I am following. I want the best method to print line numbers next to each CRLF-terminated-line in a richtextbox. I am using C# with .NET. I have tried using ListView but it is inefficient when number of lines grow. I have been successful in using Gr...

WCF[Internet scenario]. Fastest way transmit\serialize(de) data

Hello guys. My wcf is hosted by IIS and used basicHttpBinding. My common data is datasets, whci I should serialize and transmit to client. I haven't got hundreads of MB, but I want to trnasmit it to client with best perfomance. As I understand I should use MTOM encoding. Right? Also want to know about type of transmitting object: DataS...

in PHP, which is faster - reading a file or a database call?

I've a web app built in PHP with Zend on a LAMP stack. I have a list of 4000 words I need to load into memory. The words have categories and other attributes, and I need to load the whole collection every time. Think of a dictionary object. What's the best way to store it for quick recall? A flat file with something like XML, JSON or a ...

Is PARTITION RANGE ALL in your explain plan bad?

Here's my explain plan: SELECT STATEMENT, GOAL = ALL_ROWS 244492 4525870 235345240 SORT ORDER BY 244492 4525870 235345240 **PARTITION RANGE ALL** 207633 4525870 235345240 INDEX FAST FULL SCAN MCT MCT_PLANNED_CT_PK 207633 4525870 235345240 Just wondering if this is the best optimized plan for querying huge partitioned table...

does, myval = (someconditon) ? someVal : myval get optimized to not set the value in case it's false

CPath = (CPath == null) ? Request.Path : CPath; First of all I wish CLR would just let me do the ? Request.Path and not bother me with creating a : But I'm asking will it optimize it away? Or still assign. ...

Does this top look healthy to you?

I run a server with the following specs: Intel i7 920 8 GB RAM Linux 2.6.32-25-server #44-Ubuntu 10.04 SMP Fri Sep 17 21:13:39 UTC 2010 x86_64 GNU/Linux 75 Apache processes Low-end hardware RAID-1 with 2 disks Historically all our problems with scaling the service have been disk bound but currently we see higher load numbers than bef...

Is it a good idea to use XML files to present data that is not updated often? VS MYSQL query

Hi, I'm building my website and I'd like to limit calls to my MYSQL database. One idea I have is to use XML files to present information that does not need to be updated as regularly as every page load. Two example are Site navigation which might only change once a week. The number of items in stock which will in most situations on...

How to list directories faster?

I have a few situations where I need to list files recursively, but my implementations have been slow. I have a directory structure with 92784 files. find lists the files in less than 0.5 seconds, but my Haskell implementation is a lot slower. My first implementation took a bit over 9 seconds to complete, next version a bit over 5 secon...

how to avoid repetition of data for a repeated dropdownlist input?

I have a webpage that should be relatively lightweight, the problem is that i've got a table with editable user data on each line and the data includes a dropdownlist with hundreds of options. i've argued against the use of so much values but i guess i wasn't able to come up with a satisfying solution; so the ginormous dropdownlist stu...

Minimize html, doubts and questions.

Hi all. Minimizing html is the only section on Google's Page Speed where there is still room for improvement. My site is all dynamic and the HTML is already Deflated so there is no reason to put any more pressure on the server (I don't want to minimize pages real time before sending). What I could do was to minimize the template fil...

How could these case conversion functions be improved?

As a learning exercise, my three functions—ToggleCase, LowerCase and UpperCase—each expect a pointer to an ASCII char string, terminated by the null character; they work as expected. Are there more efficient or faster methods of accomplishing this task? Am I breaking any unspoken rules of good C coding? I've made use of macros because...

Auto redirect / download if image doesn't exist - optimisation

I have a lot of images on my website, they are pulled from an image server onto the main server when requested to save disk space at my hosting server. To achieve this I have an entry in my .htaccess file that basically internally redirects people from /images/image.jpg to download.php which checks to see if the file exists. If the fil...

Bin-packing (or knapsack?) problem

I have a collection of 43 to 50 numbers ranging from 0.133 to 0.005 (but mostly on the small side). I would like to find, if possible, all combinations that have a sum between L and R, which are very close together.* The brute-force method takes 243 to 250 steps, which isn't feasible. What's a good method to use here? Edit: The combi...