performance

Connecting to Oracle from ASP.NET is very slow - how to diagnose?

I have an ASP.NET application that's connecting to an oracle database. Performance on some queries in dev is very slow - on the order of 90 seconds to connect to the database, run a a query (actually, call a SP in a package) and return a single row of results. I've run a profiler on the app, and just about 100% of the time is spent in ...

Number VS Varchar(2) Primary Keys

I'm now to this point of my project that I need to design my database (Oracle). Usually for the status and countries tables I don’t use a numeric primary key, for example STATUS (max 6) AC --> Active DE --> Deleted COUNTRIES (total 30) UK --> United Kingdom IT --> Italy GR --> Greece These tables are static, not updated through the a...

What is the fastest way to parse large XML docs in Python?

I am currently the following code based on Chapter 12.5 of the Python Cookbook: from xml.parsers import expat class Element(object): def __init__(self, name, attributes): self.name = name self.attributes = attributes self.cdata = '' self.children = [] def addChild(self, element): self.chi...

Querying list items and using SharePoint web services vs the object model

My company is looking into writing a custom application that will need to perform many list item queries across multiple site collections. It will need to run for WSS 3.0 and it 'would be nice' if it worked on WSS 2.0 as well. It won't be designed for MOSS/SPS but again it 'would be nice' if it worked on these platforms. There is no rest...

Is it possible to change Garbage Collection behavior in Java ME?

I was wondering if it is possible to tweak the way garbage collector works on JavaMe in order to improve performance somehow(may reducing the number of passages)? I´ve seen some articles about it, but mostly directed Java SE and most of them says GC is highly dependant on the maker. How much would that be. ...

In WCF, should you have large MaxBufferPoolSize value for large messages?

For this WCF service I have developed, I have to set MaxReceivedMessageSize to 5MB. My current problem is figuring out whether it is better to have a larger MaxBufferPoolSize value, like 5MB, or retain the original 512KB value. Does anyone knows what is the recommended setting for this scenario? In short, should I set MaxBufferPoolSize ...

Optimizing Code

You are given a heap of code in your favorite language which combines to form a rather complicated application. It runs rather slowly, and your boss has asked you to optimize it. What are the steps you follow to most efficiently optimize the code? What strategies have you found to be unsuccessful when optimizing code? Re-writes: At wh...

Is there a major performance gain by using stored procedures?

Is it better to use a stored procedure or doing it the old way with a connection string and all that good stuff? Our system has been running slow lately and our manager wants us to try to see if we can speed things up a little and we were thinking about changing some of the old database calls over to stored procedures. Is it worth it? T...

Best way to check for current date in where clause of sql query.

I'm trying to find out the most efficient (best performance) way to check date field for current date. Currently we are using: SELECT COUNT(Job) AS Jobs FROM dbo.Job WHERE (Received BETWEEN DATEADD(d, DATEDIFF(d, 0, GETDATE()), 0) AND DATEADD(d, DATEDIFF(d, 0, GETDATE()), 1)) ...

Sorting on the server or on the client?

Hello, I had a discussion with a colleague at work, it was about SQL queries and sorting. He has the opinion that you should let the server do any sorting before returning the rows to the client. I on the other hand thinks that the server is probably busy enough as it is, and it must be better for performance to let the client handle the...

Which is faster in Python: x**.5 or math.sqrt(x)?

I've been wondering this for some time. As the title say, which is faster, the actual function or simply raising to the half power? UPDATE This is not a matter of premature optimization. This is simply a question of how the underlying code actually works. What is the theory of how Python code works? I sent Guido van Rossum an email ca...

Benchmark problems for testing concurency

For one of the projects I'm doing right now, I need to look at the performance (amongst other things) of different concurrent enabled programming languages. At the moment I'm looking into comparing stackless python and C++ PThreads, so the focus is on these two languages, but other languages will probably be tested later. Ofcourse the c...

MySQL stored procedure vs. multiple selects

Hi all, Here's my scenario: I've got a table of (let's call them) nodes. Primary key on each one is simply "node_id". I've got a table maintaining a hierarchy of nodes, with only two columns: parent_node_id and child_node_id. The hierarchy is maintained in a separate table because nodes can have an N:N relationship. That is to say,...

Struts 2 & Dojo files are too heavy and affect site's performance.. Any remedies?

Well.. we've developed a j2ee application using struts2 ajax capabilities. We find that the dojo implementation is quite slow. We did the following things: 1. Custom build of the dojo library. (increased dojo.js from 240kb to 350kb) 2. Took all the static stuff out of the struts jar and kept it outside. The performance was significantly...

Which SQL statement is faster? (HAVING vs. WHERE...)

SELECT NR_DZIALU, COUNT (NR_DZIALU) AS LICZ_PRAC_DZIALU FROM PRACOWNICY GROUP BY NR_DZIALU HAVING NR_DZIALU = 30 or SELECT NR_DZIALU, COUNT (NR_DZIALU) AS LICZ_PRAC_DZIALU FROM PRACOWNICY WHERE NR_DZIALU = 30 GROUP BY NR_DZIALU ...

C++: delete vs. free and performance

Consider: char *p=NULL; free(p) // or delete p; What will happen if i use free and delete on p? If a program taking more time for execution, suppose 10 minutes, is there any way to reduce its running time to 5 minutes? ...

Always use jquery selectors or cache them in variables?

jQuery selectors are wonderful, but I sometimes I find myself typing them over and over, and it gets a little annoying. $('#mybutton').click(function() { $('#message-box').doSomething(); $('#message-box').doSomethingElse(); $('#message-box').attr('something', 'something'); }); So often I like to cache my objects in varia...

What is FLOP/s and is it a good measure of performance?

Hi, I've been asked to measure the performance of a fortran program that solves differential equations on a multi-CPU system. My employer insists that I measure FLOP/s (Floating operations per second) and compare the results with benchmarks (LINPACK) but I am not convinced that it's the way to go, simply because no one can explain to me...

Other examples of magical calculations

I have seen this topic here about John Carmack's magical way to calculate square root, which refers to this article: http://www.codemaestro.com/reviews/9. This surprised me a lot, I just didn't ever realized that calculating sqrt could be so faster. I was just wondering what other examples of "magic" exist out there that computer games...

What is the most efficient way to manage a large set of lines in OpenGL?

I am working on a simple CAD program which uses OpenGL to handle on-screen rendering. Every shape drawn on the screen is constructed entirely out of simple line segments, so even a simple drawing ends up processing thousands of individual lines. What is the best way to communicate changes in this collection of lines between my applicati...