optimization

UITableViewCell subclassing optimization

If i do a custom cell, is it best practice to... put icons and labels all on one view and drop it to the contentView (assuming you want everything to shift in edit mode) or put all editable stuff (labels) on one view, and non editable (icons) on another view and drop them to the contentView or it doesn't matter because when the label t...

What form of alias analysis does Visual C++ use?

I'm trying to figure out what form of alias analysis is used in Visual C++. Its also known as pointer analysis, mod-ref analysis, points-to analysis or side-effect analysis, and is pretty close to escape analysis or shape analysis (should you have seen those terms bandied about). If anyone knows where MSDN discusses this sort of thing, ...

WebSphere Application Server EJB Optimization

We are working on developing a Java EE based application. Our application is Java 1.5 compatible and will be deployed to WAS ND 6.1.0.21 with EBJ 3.0 and Web Services feature packs. The configuration is currently one cell with two clusters. Each cluster will have two nodes. Our application, or our system, as I should rather say, comes i...

Optimize PHP framework loading

I have a custom built application framework written in PHP which I have been tasked to optimize. This framework is a shared codebase which loads MVC "modules" to provide various functionality. Each module is a directory containing multiple PHP classes for controllers and models and PHP files for views. The entire framework loads for alm...

Upsert with .net sqladapter

Dim sSelect As String = _ "SELECT * FROM Contacts" & _ " WHERE DataSetID = @DataSetID AND ID >= @FirstID AND ID <= @LastID ORDER BY ID" Dim dsDBFiles As New DataSet() Dim cmd As New SqlClient.SqlCommand(sSelect, m_connection) cmd.Parameters.Add("@FirstID", SqlDbType.Int).Value = nFirstID ...

Reading from TCPSocket is slow in Ruby / Rails

I have this simple piece of code that writes to a socket, then reads the response from the server. The server is very fast (responds within 5ms every time). However, while writing to the socket is quick -- reading the response from the socket is always MUCH slower. Any clues? module UriTester module UriInfo class << self ...

How to get optimization from a "pure function" in C#?

If I have the following function, it is considered pure in that it has no side effects and will always produce the same result given the same input x. public static int AddOne(int x) { return x + 1; } As I understand it, if the runtime understood the functional purity it could optimize execution so that return values wouldn't have to ...

With 2 nested gridviews with large data sets each what's the most optimized way to implement

Say I have 2 tables in a database, each with 100,000's of rows in detail and 10,000's of rows in the master 5 columns each, properly indexed and related. I want to have master/detail nested gridviews. What's the fastest architecture I could design in .net to do this? The largest result set on the master could be in the thousands (usua...

how to decide between a rewrite or a hardware upgrade?

If you had a working product that was slow and memory hungry. What would decide to do between these 2 options and why? The product would work perfectly if you buy "the" good server which would be high in the 5 digits and maybe in the 6 digits. You have the sources and the resources to change it and it would cost about the same of opt...

How bad is my query?

Ok I need to build a query based on some user input to filter the results. The query basically goes something like this: SELECT * FROM my_table ORDER BY ordering_fld; There are four text boxes in which users can choose to filter the data, meaning I'd have to dynamically build a "WHERE" clause into it for the first filter used and the...

How Do I Create "Watch" System? Looking For Best Practices

I have a fairly complex community site (in php/mysql) with a number of "things" that the registered users can "watch". "Things" are: Posts, comments, event updates, user status changes, etc. At least 10 different types of "things" are available and a user can watch any other user's "things" (Think facebook) "Watch" means: A user can w...

optimization in gcc

Hi, I have two questions: (1) I learned somewhere that -O3 is not recommended with gcc, because The -O3 optimization level may increase the speed of the resulting executable, but can also increase its size. Under some circumstances where these optimizations are not favorable, this option might actually make a program slower. in fa...

Why is my "exploded" Python code actually running faster?

I'm in an introductory comp-sci class (after doing web programming for years) and became curious about how much speed I was gaining, if any, with my one-liners. for line in lines: numbers.append(eval(line.strip().split()[0])) So I wrote the same thing with painfully explicit assignments and ran them against each other. for line in ...

comparion/performance of database field as int vs char(1)

does one perform better over the other in terms of indexing/quering etc ? e.g. declaring a column as active Char(1) with 'Y' / 'N' values vs is_active tinyint with values 1 / 0 Anecdotally speaking most places it seems people prefer to use char(1) whereas my tendency is to declare them as tinyint/int not the least because it's easy...

writing image to directory fail

Hi, Some overflow runtime error happens when my C++ program is trying to write some .png images into a directory. The directory where the images are written into is given as a command line argument. The program is compiled with gcc -ggdb3 -O3. It is strange that the error disappears if I change the directory to another one when rerun...

String concatenation vs string buffers in Javascript

I was reading this book - Professional Javascript for Web Developers where the author mentions string concatenation is an expensive operation compared to using an array to store strings and then using the join method to create the final string. Curious, I did a couple test here to see how much time it would save and this is what I got - ...

Background image shows through briefly

I have a site that uses a large centered background image, which naturally loads a tad slower than the other elements on the page. For the most part this works okay, but there is also a repeat-x background image that covers the background for large monitors. The only problem is that this smaller file loads first and flashes briefly befor...

Indexing text files in PHP

I have been set a challenge to create an indexer that takes all words 4 characters or more, and stores them in a database along with how many times the word was used. I have to run this indexer on 4,000 txt files. Currently, it takes about 12-15 minutes - and I'm wondering if anyone has a suggestion for speeding things up? Currently...

What are the known C/C++ optimizations for GCC

I am have a lot of code that I need to optimize and make it run faster. I used opreport to tell me where the code spends a lot of time. I use the following command to get the statistics opreport -g -l -d Suggestions to get better statistics are appreciated using different flags, perhaps find it per line number instead of function numb...

What is the best way to get the most useful output from oprofile?

Using tools such as: opreport opcontrol opannotate I am starting to use this tool and trying to find the best combinations, examples to get the most out of profiling. Thanks ...