The usual sob story: my tests are running slowly.
My first thought was to profile the whole test suite to look for obvious wins (stubbing out network access or caches), so I added a ruby-prof task:
RubyProf::ProfileTask.new(:units) do |t|
t.test_files = FileList[RAILS_ROOT + '/test/unit/**/*_test.rb']
t.output_dir = Dir.tmpdir
t....
In this thread know how to make a eager load in rails, but how to do this nested?
I.e:
# get category, random product and random photo
@category = Category.find(params[:id], :include => random_product, :include => random_photo)
I don't know if I explain...
Thanks in advance.
...
Does anyone know how to instruct rails to NOT cache classes that are included within the lib folder?
...
Hi,
I have to do profiling of the Java application. I would appreciate if anyone let me know the free Java pr-filer. I heard about YourKit but don't know much about performance of it.
Alos like the information on Java code optimization.
Thanks in advance.
Thanks
...
I am trying to scan a dataset using a loop in R, to see if the data points in the subset of data fulfill some rules, an example is pasted here:
loop.ward <- 1
loop.control.chart <- 1
while (loop.ward <= length(unique(control.chart[,"ward"])))
{
loop.weekly.count <- 3
while (loop.weekly.count <= nrow(control.chart[control.chart[,"w...
I have a requirement to (very) quickly process strings of a limited range, tallying their values. The input file is of the form:
January 7
March 22
September 87
March 36
and so forth. Because the line widths are identical, I can simply read in a line with fread reasonably fast, and I've developed a perfect hashing function ...
Working in some legacy code, I've run across a ton of Try/Catch statements. Try/Catch isn't something that they taught in my Zend certification classes, and in 10 years I've not worked with another PHP developer who's used it. Does Try/Catch have extra overhead compared to doing if statements? What would make it more or less desirable...
I'm building an application that is seriously slower than it should be (a process takes 4 seconds when it should take only .1 seconds, that's my goal at least).
I have a bunch of methods that pass an array from one to the other. This has kept my code nice and organized, but I'm worried that it's killing the efficiency of my code.
Ca...
How can I optimise out this nested for loop?
The program should go through each word in the array created from the word text file, and if it's greater than 8 characters, add it to the goodWords array. But the caveat is that I only want the root word to be in the goodWords array, for example:
If greet is added to the array, I don't want...
I wanted to test foldl vs foldr. From what I've seen you should use foldl over foldr when ever you can due to tail reccursion optimization.
This makes sense. However, after running this test I am confused:
foldr (takes 0.057s when using time command):
a::a -> [a] -> [a]
a x = ([x] ++ )
main = putStrLn(show ( sum (foldr a [] [0.. 1000...
Hello, I was wonder how I should record this information:
# num: material: type: geo: light: tex: extralight: verts:
0: 13 0x0000 4 3 0 0.0000 3 0, 0 1, 1 2, 2
1: 13 0x0000 4 3 0 0.0000 3 2, 2 3, 3 4, 4
2: 13 0x00...
I have a table with about 35 million rows. each has about 35 integer values and one time value (last updated)
The table has two indexes
primary - uses two integer values from the table columns
Secondary - uses the 1st integer from the primary + another integer value.
I would like to delete old records (about 20 millions of them) accordi...
Starting a few weeks ago, compiling a project (VB.NET, .NET 2.0, VS 2010) has taken several times as long as before. In Task Manager, I noticed ResXtoResources.exe taking lots of CPU for a while. I've finally been able to get some data on this using MSBuild's 'Diagnostic' output setting, and comparing that output to what I see in a branc...
Hi there,
I want to speed up an array multiplication in C99.
This is the original for loops:
for(int i=0;i<n;i++) {
for(int j=0;j<m;j++) {
total[j]+= w[j][i] * x[i];
}
}
My boss asked my to try this, but it did not improve the speed:
for(int i=0;i<n;i++) {
float value = x[i];
for(int...
One of biggest optimizations I've used is regard to this question:
http://stackoverflow.com/questions/1152414/import-from-text-file-to-sql-server-database-is-ado-net-too-slow
with the initialized version, insert each row per query use ADO.NET, I was able to insert about 100 rows/second. When I switched to batch insert, it rose to 1000 ...
Hi! I have some code that is going to be run thousands of times, and was wondering what was faster.
array is a 30 value short array which always holds 0, 1 or 2.
result = (array[29] * 68630377364883.0)
+ (array[28] * 22876792454961.0)
+ (array[27] * 7625597484987.0)
+ (array[26] * 2541865828329.0)
+ (array[25...
I have a set a data that I need to calculate their "consecutive mean" (I dunno if it is the correct name, but I can't find anything better), here is an example:
ID Var2 Var3
1 A 1
2 A 3
3 A 5
4 A 7
5 A 9
6 A 11
7 B 2
8 B 4
9 B 6
10 B 8
11 B 10
Here I need to calculat...
Hi there,
So i have a query that looks like this:
SELECT col1, col2, col3 ...
FROM action_6_members m
LEFT JOIN action_6_5pts f ON f.member_id = m.id
LEFT JOIN action_6_10pts t ON t.member_id = m.id
LEFT JOIN action_6_weekly w ON w.member_id = m.id
WHERE `draw_id` = '1' ORDER BY m.id DESC LIMIT 0, 20;
now this is doing a massive join...
I have a large SQL Server database with about 40 columns and hundreds of millions of rows.
This table is supposed to be loose in schema so I have a lot of columns as VARCHAR(MAX) even where it could have been BIGINT, DATETIME, INT etc. Does this have an impact on querying time/efficiency? e.g. will
SELECT TOP 100 * FROM CustomerId = 3...
Profiler says that 50% of total time spends inside this function. How would you optimize it?
It converts BMP color scheme to YUV. Thanks!
Update: platform is ARMV6 (writing for IPhone)
#define Y_FROM_RGB(_r_,_g_,_b_) ( ( 66 * _b_ + 129 * _g_ + 25 * _r_ + 128) >> 8) + 16
#define V_FROM_RGB(_r_,_g_,_b_) ( ( 112 * _b_ - 94 * _g_ - 18 ...