optimization

Traversing a Binary Tree with multiple threads

So I'm working on a speed contest in Java. I have (number of processors) threads doing work, and they all need to add to a B-Tree. Originally I just used a synchronized add method, but I wanted to make it so threads could follow each other through the tree (each thread only has the lock on the object it's accessing). Unfortunately, even ...

Optimizing ViewState

Does anyone have any ideas or references they could point me to regarding optimizing the viewstate of my ASP .NET application? I don't want to turn it off all together, and the main goal of optimizing it is to speed up performance so I don't want to run an expensive function to recursively disable the viewstate for certain controls becau...

Pass by value or reference, to a C++ constructor that needs to store a copy?

Should a C++ (implicit or explicit) value constructor accept its parameter(s) by value or reference-to-const, when it needs to store a copy of the argument(s) in its object either way? Here is the shortest example I can think of: struct foo { bar _b; foo(bar [const&] b) // pass by value or reference-to-const? : _b(b) { ...

Most Efficent Way to Add Formatting Excel - VBA

I have a macro that add hundreds of lines of data to an excel spreadsheet. I call a procedure from a loop which inserts each line of data. I have been applying the formatting for the row each time that I insert that data. However, during my testing I have found that I can insert all of the data about 3/4 of second faster (3.3 sec vs. ...

MySQL Table with TEXT column

Hello. I've been working on a database and I have to deal with a TEXT field. Now, I believe I've seen some place mentioning it would be best to isolate the TEXT column from the rest of the table(putting it in a table of its own). However, now I can't find this reference anywhere and since it was quite a while ago, I'm starting to think...

Compare the textual content of websites

I'm experimenting a bit with textual comparison/basic plagiarism detection, and want to try this on a website-to-website basis. However, I'm a bit stuck in finding a proper way to process the text. How would you process and compare the content of two websites for plagiarism? I'm thinking something like this pseudo-code: // extract tex...

fast lookup for the last element in a Django QuerySet?

I've a model called Valor. Valor has a Robot. I'm querying like this: Valor.objects.filter(robot=r).reverse()[0] to get the last Valor the the r robot. Valor.objects.filter(robot=r).count() is about 200000 and getting the last items takes about 4 seconds in my PC. How can I speed it up? I'm querying the wrong way? ...

WPF sluggish rendering/animation performance?

I've been trying to animate around 1000 lines which are all added to a Canvas, and it is extremely slow to the extend that animation is not feasible at all. At first I thought it was probably because of all the calculations, but then I tried a very simple experiment. I generated around 1000 random lines and I tried to move them to new r...

Implementation of Comments, Is there any best practice for this?

Well I need to implement the comments feature on a custom coded social networking website. The comments need to be implemented on various pages like videos, pictures, albums etc etc similar to facebook. What would be the best practice for implementing this ? Making one global comments table with fields like this, and grab comments base...

Performance of one huge unix directory VS a directory tree?

My PHP project will use thousands of pictures and each needs only a single number for it's storage name. My initial idea was to put all of the pictures in a single directory and name the files "0.jpg", "1.jpg", "2.jpg", and all the way to "4294967295.jpg" . Would it be better performance-wise to create a directory tree structure and na...

What's the name of the problem that relates to optimizing closures on a stack-based system?

I remember hearing about a general optimization problem that relates to function closures, stating that in general it's difficult to optimize the creation of a closure using only stack-based memory management. Do any of you remember the name of this optimization problem, possibly with an example or link to relevant page? ...

SQL speed SSRS optional fields

I'm returning results from the following query which is taking too long when running. I'm not sure how to eliminate the where parameters when they are not used in SSRS. All the @variables are strings select S.SBSB_ID, LTRIM(RTRIM(M.MEME_FIRST_NAME)) + ' ' + LTRIM(RTRIM(M.MEME_LAST_NAME)) AS Names, (CASE M.MEME_REL WHEN 'M' THEN 'Subscr...

Optimizing a pinhole camera rendering system

Hello, I'm making a software rasterizer for school, and I'm using an unusual rendering method instead of traditional matrix calculations. It's based on a pinhole camera. I have a few points in 3D space, and I convert them to 2D screen coordinates by taking the distance between it and the camera and normalizing it Vec3 ray_to_camera = (...

Optimizing binary tree inserts to O(1) with hash map for write heavy trees

First of all I assume I've missed something major when thinking about this, but I still wanted to post about it to see if I really didn't miss anything, on with it... I have a pretty write heavy binary tree (about 50/50 between writes and reads), and on the way home today I was thinking about ways to optimize this, especially make the w...

Memory Appropriation on a LAMP Server

How does one determine how much memory to appropriate to running services? I have a small LAMP server, with Xcache for PHP and Memcache for MySQL. How would I go about estimating the optimal amount of ram to dedicate to each of the services? ...

Returning std::pair versus passing by non-const reference

Why is returning a std::pair or boost::tuple so much less efficient than returning by reference? In real codes that I've tested, setting data by non-const reference rather than by std::pair in an inner kernel can speed up the code by 20%. As an experiment, I looked at three simplest-case scenarios involving adding two (predefined) integ...

SQL Database dilemma : Optimize for Querying or Writing?

I'm working on a personal project (Search engine) and have a bit of a dilemma. At the moment it is optimized for writing data to the search index and significantly slow for search queries. The DTA (Database Engine Tuning Adviser) recommends adding a couple of Indexed views inorder to speed up search queries. But this is to the detrimen...

How to use Squid(Proxy and reverse proxy) with joomla

hi i want some optimization tips on joomla performance i used memcache but i dont now how to use proxy and reverse proxy () with joomla please help Thanks ...

Repeating functions in a MySQL query

Based on my previous question I am running a query like so: SELECT DISTINCT DATE_FORMAT(STR_TO_DATE(`value`, '%d/%m/%Y'), '%M %Y') AS `avail` FROM table ORDER BY STR_TO_DATE(`value`, '%d/%m/%Y') Thevalue field is in the format dd/mm/yyyy and using STR_TO_DATE I convert it to yyyy-mm-dd. However I repeat that function call twice, so I ...

Best practice for a SQL Archiving Stored Procedure

I have a very large database (~100Gb) primarily consisting of two tables I want to reduce in size (both of which have approx. 50 million records). I have an archive DB set up on the same server with these two tables, using the same schema. I'm trying to determine the best conceptual way of going about removing the rows from the live db a...