performance

SQL Server: Design: Embedded Select statement or INNER JOIN ?

I've the following table structure - Site: Master tablefor site Org: Master table for Org User: Master table for User (each user links to a unique Org via User.OrgId) OrgSite: Store some 'Org specific' Site details (OrgId, SiteId, SiteName, SiteCode). Not ALL sites but only those which are accessible to Org. ...

lazy load or early load for python?

Hi All: We've got the following code sample: big_static_data = { "key1" : { "subkey1" : "subvalue1", ... }, "key2" : ... } class StaticDataEarlyLoad: def __init__(self): self.static_data = big_static_data # other init def handle_use_id(self, id): return complex_handle(self.static_d...

If statement or Where extension with a For Each loop?

I was wondering which of the two code samples would be more efficient (or is the difference between the two negligible)? For Each apple in AppleController.GetRedApples().Where(Function(a) PriceController.OnSale(a)) 'do something Next or For Each apple in AppleController.GetRedApples() If PriceController.OnSale(apple) Then ...

How could running code in the debugger makes it faster?

The title says it all. It never happened to me. In Visual Studio, I have a part of code that is executed 300 times, I time it every iteration with the performance counter, and then average it. If I'm running the code in the debugger I get an average of 1.01 ms if I run it without the debugger I get 1.8 ms. I closed all other apps, I re...

Java HashMap performance optimization / alternative

I want to create a large HashMap but the put() performance is not good enough. Any ideas? Other data structure suggestions are welcome but I need the lookup feature of a Java Map: map.get(key) In my case I want to create a map with 26 million entries. Using the standard Java HashMap the put rate becomes unbearably slow after 2-3 milli...

Using T-SQL AVG or taking Average after results returned using LINQ

I have a stored procedure that uses a view to pull 6 averages. The SQL database is SQL Server 2000. When I run it in the Query analyzer, it takes roughly 9 seconds. What can I do to get better performance? Should I return the rows using LINQ and determine an average that way? Will it be faster? Here's an example of my current sproc: cr...

Simple read vs write boolean variable performance comparison question

What should be the preferred way by programmers: 1) Only Write: SomeBoolean = True 2) Read but write only if necessary If Not SomeBoolean Then SomeBoolean = True ...

Cost of logging IP address for user activity

If I were to log user IP addresses for each function he/she performs would that slow up the application in any way? For example I might log the last sign-in IP, and because the IP address will be overwritten on next login, I would have to log the IP again in a separate table where he/she posts a message, and again for another site functi...

How to quickly find a sharepoint document library by id?

Given the SPList.ID and a site collection (or an SPWeb with subwebs), how do I quickly find the document library with the given ID? I can recursively enumerate through all webs and perform a web.Lists[guid] on each one of them, but there might be thousands of subwebs in my case, and I'm looking for a realtime solution. If there is no ...

Does a function call in the Where(...) clause of a Linq to Nhibernate query negatively affect performance?

I use linq to nhibernate and the IQueryable.Where function in an application I'm building. And what mystifies me is how do the Expressions I create and pass to the Where function of a INhibernateQueryable affect performance. I'm not really sure what are the gotchas I should avoid in writing these query Expressions, in terms of perfor...

Graph Adjacency List How to implement O(1) lookup for nodes/vertexes. Array?

I read in the specifications for graphs implemented with Adjacency List that adding edges is done in constant time. BUT that would require a node lookup with O(1). I would like best possible performance. The question here is which datatype would would give me that. Hashmap has been considered, worst case with hashmap is still O(n). Cou...

How to copy large set of data in SQLServer db

I have a requirement to take a "snapshot" of a current database and clone it into the same database, with new Primary Keys. The schema in question consists of about 10 tables, but a few of the tables will potentially contain hundreds of thousands to 1 million records that need to be duplicated. What are my options here? I'm afraid tha...

Why does TOP or SET ROWCOUNT make my query so slow?

I have a SQL Server 2008 database with approximately 14 millions rows. In it there are two tables Table1 rowId int, primary key someData1 int someData2 int... Table2 id int, primary key rowId ==> int, refers to the rowId from Table1 someCalculatedData int... Table2.rowId is not a foreign key, but I did mak...

Regular expressions performance: Boost vs. Perl

I'm looking for a performance comparison between perl and boost regular expression. I need to design a piece of code which relies very heavily on regular expressions, and can choose between: running it through a boost regex dispatching a perl interpreter and do the work in perl I know perl is known for it's optimized string pro...

Find a node in an XML file - performance improvement in C#

Say I need to find a particular node in an XML file, using C#. <node attribute="my-target-attribute"> "my-target-attribute" is a variable input at runtime. The node is in no particular place in the XML file, I basically just need to scan the entire XML hierarchy until I find a node with the matching attribute. Is there any way I can...

Is it possible to get count(*) and * more efficiently ?

I'm now running two queries,which is not so efficient I think: select count(*) from table where id>0; select * from table where id>0 limit 10; ...

Database alternatives?

I was wondering the trade-offs for using databases and what the other options were? Also, what problems are not well suited for databases? I'm concerned with Relational Databases. ...

Are there any Testing Tools for this

We have a Winforms application that is deployed over a load balanced terminal server farm. (If it matters, Users connect to the application using a Propalms client). I am trying to figure out if there are any tools out there to do some performance testing. I am aware that tools like QTP enable us to do functional testing but we need some...

What will it take for Transactional Memory to be viable?

I've been doing some work on transactional memory and its viability for systems programming (databases, operating systems, servers, etc.). My own experience employing transactions, together with having seen how few communities use transactions in real code, has raised a question: What would convince you, a developer writing production co...

SqlServer performance with a large number of tables in database

I am updating a piece of legacy code in one of our web apps. The app allows the user to upload a spreadsheet, which we will process as a background job. Each of these user uploads creates a new table to store the spreadsheet data, so the number of tables in my SqlServer 2000 database will grow quickly - thousands of tables in the near t...