performance

jQuery appending html versus appending existing element

Hello. I have a string big_html and I want to add it to some div. I have observed a performance difference in the following: $('#some-div').append( big_html ); // takes about 100 ms //create it first var append_objs = $(big_html); $('#some-div').append( append_objs ); //takes about 150 ms Does anyone know why this happens ? Thank you...

How to improve the copy speed from D3D surface back to system memory

I'm using the following codes to copy D3D surface back to system memory, but the performance is bad when call LockRect operation, it spends lot of time of this function. Is there a way to improve it? Thanks in advance. Below is sample codes. D3DDev->GetRenderTargetData(renderTarget, offscreenSurface); // Lock the surface to read pixel...

How much performance do I lose by increasing the number of trips to SQL Server?

I have a web application where the web server and SQL Server 2008 database sit on different boxes in the same server farm. If I take a monolithic stored procedure and break it up into several smaller stored procs, thus making the client code responsible for calls to multiple stored procedures instead of just one, and I going to notice ...

c# enum and performance

My app has a lot of different lookup values, these values don't ever change, e.g. US States. Rather than putting them into database tables, I'd like to use enums. But, I do realize doing it this way involves having a few enums and a lot of casting from "int" and "string" to and from my enums. Alternative, I see someone mentioned using...

Performance of XElement LINQ query against attribute or element

Hi, I'm using LINQ to XML to search the XML below (small section of final document) initially on the Country name attibute and was wondering if there would be any performance benefit in creating the name as a child element rather than attribute <Countries> <Country name="United Kingdom"> <Grades> <Grade>PA</Grad...

Thread.Sleep(0) : What is the normal behavior?

To my understanding a Thread.Sleep(0) force a context switch on the OS. I wanted to check what was the maximum amount of time that could pass in an application before to receive some CPU time. So I built an application that does Thread.Sleep(0) in a while loop (c#) and calculate the time that pass between each call. When this applicat...

is .net faster than java

I heard a lot of people saying that java is slow comparing .net, like they had servers with application on java with jboss hibernate and other stuff and it was really slow, but when they moved to .net all the performance issues disappeared. Is java really much slower ? isthere any benchmarks made ? ...

C++ vectors question

Hello! Does anyone know how to speed up boost::numeric::ublas::vector? I am using typedef ublas::vector<float, ublas::bounded_array<float, 3> > MYVECTOR3 and compare it's speed to D3DXVECTOR3 on plain operations. The test look the following way: #include <d3dx9.h> #pragma comment(lib, "d3dx9.lib") static const size_t kRuns = static_...

Does List<T> create garbage in C# in foreach

Correct me if im wrong but doing a foreaver an IEnumerable<T> creates garbage no matter what T is. But I'm wondering if you have a List<T> where T is Entity. Then say there is a derived class in the list like Entity2D. Will it have to create a new enumerator for each derived class? Therefore creating garbage? Also does having an interf...

Does applying additional clauses to a compiled query cause a recompile?

If I have a compiled entities query via CompiledQuery.Compile and I then tack on another .Where() clause or .OrderBy() clause, do these addition clauses force a full recompile, a partial recompile, or no recompile? ...

How to use KDTree to make top-k query and range query on arbitrary dimensions

Hi, I have used KD-tree(libkdtree++) to store a multi-dimensional data set, and the requirements here is this data set can support top-k/range queries on different dimensions. For example, a KDTree<3, Point> tree: to find the top 100 points whose have highest Point[1](y axis) values. From the implementation of libkdtree++, what's sim...

android: gson performance

I am trying to use gson to do my object mapping on the android emulator. It has been ridiculously slow when processing json data around 208 kb. I do not have any hierarchies in my json. After the object mapping is done, i can see it that gson created around 500 records. It is taking it over 3 minutes on the android emulator to map the...

page cache in rails

My home page is largely the same for all users, which makes it a candidate for page caching. however, there are a couple of things that are user specific. For example, there is a nav item that is only shown for logged in users and there is a link like logout, my profile etc, generated for specific users. Do I have to use fragment cachi...

NHibernate HQL vs CriteriaAPI vs QueryOver. Performance.

Hi, What are the performance differences between the hql and criteriaApi and QueryOver? Are there any situations where one is faster or slower than the other? Edit: I extended the question with QueryOver. ============================================= Well, I am not sure which response to mark as answer so I will mark posts with most ...

Manually enqueue reusable UITableViewCells?

I have some custom table view cells that takes a while to draw, so the first time you scroll it's not very smooth. After the first scroll, all the views are cached and the scrolling is very smooth. So what I'm wondering is if I could draw all the cells and cache them before the table view is shown and how I would do that. Would there be...

Performance overhead for properties in .NET

I read somewhere that having public properties is preferable to having public members in a class. Is this only because of abstaraction and modularity? Are there any other over-riding reasons? The property accesses are conerted into function calls by the compiler. For properties without a backup store (e.g. public string UserName { get...

Performasure and hibernate

I have some pojos, which are mapped to a tables in database. When I deploy my code into performance tuning environment, I receive bunch of org.hibernate.MappingException due to $performasure_j2eeInfo is added to them by PerformaSure tool. Is there a way, I can configure my hibernate context file, so this field mapping will ignore mapp...

Select dropdown element with 1 million options, ahem...dependent too

Say we have three dependent select dropdowns (selecting parent asynchronously populates the child via a database query): DD1: [People of this world]     DD2: [Hair Strands]         DD3: [Keratin Molecules] Ok, our options' lists won't be as large as what the names here imply, but each dropdown is going to house about 1 million option i...

C# application Performance profile shows huge JIT compiler load

I am running performance profile for a C# application on a virtual machine. The results show huge load of "JIT Compiler". When I dig further in, it shows something called "Class Loader" as the only method getting called by JIT compiler. What do I do to bring "JIT compiler" load down? ...

Unique index on every column

So here I am looking at this huge oracle 10g table. I looked at its indexes and see that ALL of the columns are under one unique index. Does this provide actually provide any performance benefits? ...