performance

How can I optimize my implementation of the "toExponential" algorithm to improve precision?

I feel like my implementation is a bit naive. Take notice of the variables min in max which have a rather small precision of +/- 0.0001. If I raise the precision any further the code is just too slow. Algorithm Code private IDynamic ToExponential(Engine engine, Args args) { var x = engine.Context.ThisBinding.ToNumberPrimitive()...

Optimising Lamda Linq to SQL query with OrderBy

I have the following lamda expression: IEnumerable<Order> query = _ordersRepository.GetAllByFilter( o => o.OrderStatus.OrderByDescending(os => os.Status.Date).First() .Status.StatusType.DisplayName != "Completed" || o.OrderStatus.OrderByDescending...

processing time per thread??

hi every1 i want to calculate the process time per thread. how do i do it.? suppose my 100 threads are executing the same method work() concurrently, then if i put the following code help me get what i seek Process thisProc = Process.GetCurrentProcess(); string procName = thisProc.ProcessName; DateTime started = thisProc.StartTime; in...

Oracle: 300 times difference in performance between databases on same server.

Hi! I'm working with a new and an old database on an oracle 9.2.0.3.0 server. Queries against tables in the new database are about 300 times slower than identical queries against tables in the old database. These databases are quite similar but there are some differences: The table I'm testing in the old one has one CHAR column (ind...

SQL Server request is very slow when nothing to retreive ?!

Hi all, We are facing a strange performance problem with "SQL Server Express 2005" in a very simple condition. We have a table with: [timestamp], [id], [value] columns. and only one primary unique index on [timestamp]+[id]. The table contains around 68.000.000 records. The request is: SELECT TOP 1 timestamp FROM table WHERE id=1234 O...

Is there a performance difference between properties vs. backing fields in read/write operations?

When working within a class on its own fields and properties, I typically only use the property when it performs some function (like limiting a value or validating or whatever). Otherwise I prefer to read/write the backing field directly. I somehow got it in my head that this would be a more generally performant way to do things, but i...

Can I become high skilled developer without learning C/C++?

Hi, I always thought that to be a "real" software developer or to work for serious companies on serious software projects, C/C++ knowledge is a requirement. A mandatory one. I also thought that building software with C# is just as building a website with ASP.NET controls: it is still possible to do for some small products, but trying t...

Converting an Object to Double?

What is the fastest way to convert an object to a double? I'm at a piece of code right now, which reads: var d = double.TryParse(o.ToString(), out d); // o is the Object... First thoughts were to rewrite this as var d = Convert.ToDouble(o); but would that actually be faster? EDIT: In addition to running the profile (by the way,...

Python fast string parsing, manipulation

I am using python to parse the incoming comma separated string. I want to do some calculation afterwards on the data. The length of the string is: 800 characters with 120 comma separated fields. There such 1.2 million strings to process. for v in item.values(): l.extend(get_fields(v.split(','))) #process l get_fields use...

Replace/Add several DOM Elements: Efficient and robust Method?

I am in search for an efficient method to replace a couple of DOM Elements - if possible in one action only. It is needed for augmenting TextNodes. If a certain word is present, it shall be wrapped in span-Tags, to which an event handler needs to be assigned later. so if a text Node contains the word it needs to turn from -#textNode ...

Help with an algorithm

I need help with making this bit of code faster: UnitBase* Formation::operator[](ushort offset) { UnitBase* unit = 0; if (offset < itsNumFightingUnits) { ushort j = 0; for (ushort i = 0; i < itsNumUnits; ++i) { if (unitSetup[i] == UNIT_ON_FRONT) { if (j == offset) unit = unitFormation[i]; ++j; } } } el...

ViewExpired exception while trying to load balance http requests

I am trying to run the jboss server (5.1.0) in clustered mode. I am having two nodes in the same host. When i access the two nodes as separate URLs it works well. I am using a Apache HTTP server to load balance my requests using the Proxy balancer (with proxy pass, proxy reverse configurations). When I access the Apache server URL, it t...

Overhead of call-by-need / call-by-name Lisp interpreter strategy

I've a partially finished interpreter for a lexically scoped 'pure Lisp' (no set!) that uses a call-by-need evaluation model which comes down to call-by-name with simple caching, the interpreter naturally uses an environment-based evaluation model. The standard way of evaluating lambda abstractions, as in, constructing a new environment...

C++ return value versus exception performance

hi. Somewhere I have read that modern Intel processors have low-level hardware for implementing exceptions and most compilers take advantage of it, to the effect that exceptions become faster than returning results state using variables. Is it true? are exceptions faster than variables as far as returning state/responding to state? re...

Best practices - Only download CSS you need, or use a minification process?

In the context of improving overall site performance (downloading and rendering speed) there appears to be a contradiction between the following two best practices: Only bring down the CSS that you need for the page being viewed. (Because too many CSS rules cause slow rendering) Always minify CSS and combine it into one file. (Because ...

MATLAB parfor is slower than for -- what is wrong?

Hi, the code I'm dealing with has loops like the following: bistar = zeros(numdims,numcases); parfor hh=1:nt bistar = bistar + A(:,:,hh)*data(:,:,hh+1)' ; end for small nt (10). After timing it, it is actually 100 times slower than using the regular loop!!! I know that parfor can do parallel sums, so I'm not sure why t...

Hard evidence that Linux is more stable than windows?

I am trying to convince management to switch from SQL Server, to MySQL on Linux. This is very much a windows house, and management seems very wary of using Linux. Can anyone provide hard facts showing Linux is more stable, higher performance than windows for running a DB server? And any other advantages? Also, nobody here knows how to...

Does performance of an event handler depends on the number of child elements

I've got a single mousedown event handler on a table with dynamically increasing number of rows (right now over thousand, in perspective should have been unlimited) and I observe a drop down in performance as the number of preloaded rows increases. The purpose of event handler is simple - figure out which row was clicked and highlight it...

Performance of C++ vs Virtual Machine languages in high frequency finance

I thought the C/C++ vs C#/Java performance question was well trodden, meaning that I'd read enough evidence to suggest that the VM languages are not necessarily any slower than the "close-to-silicon" languages. Mostly because the JIT compiler can do optimizations that the statically compiled languages cannot. However, I recently receive...

When should I use the IN operator instead of multiple OR operators in MySQL?

I need to select some records from a table where a column value is equal to any of the values in a list. This can be done using either IN operator (like WHERE column IN (v1, v2, ...)) or multiple OR operators (like WHERE column = v1 OR column = v2, ...). When should I use either of these ways? ...