Hi! I'm trying to parallelize a convolution function in C. Here's the original function which convolves two arrays of 64-bit floats:
void convolve(const Float64 *in1,
UInt32 in1Len,
const Float64 *in2,
UInt32 in2Len,
Float64 *results)
{
UInt32 i, j;
for (i = 0; i < in1Len;...
I seem to remember that there is a command to look at a mysql table and let you know things like maximum size of strings and integers and such so you can optimize the size of your index/table.
Do you know what that command is?
G-Man
...
The C++0x FCD states in 23.3.6.2 vector capacity:
void shrink_to_fit();
Remarks: shrink_to_fit is a non-binding request to reduce capacity() to size(). [Note: The request is non-binding to allow latitude for implementation-specific optimizations. end note]
What optimizations are intended to be allowed?
...
Hello,
I must warn you, this code will hurt your eyes, so please don't judge me, i'm trying to improve the way I handle errors
all my tests are like this :
if ($something < 27)
{
$error_IP= '<div class="error_message">something bad</div> ';
}else{
$erreur_IP='';
}
and here's the ugliest thing :
if( !isset($_POST) || ($erreur_captc...
I set VC++ to generate ASM for a method which calls sqrt, to see if it's generating FPU or SSE instructions. However when sqrt is called, I don't see the ASM. I only see a call to some function __CIsqrt, which I assume is some system sqrt function. I can't see any ASM for that to know what it is doing?
...
i'm trying to do a research/project on register allocation using graph coloring where i am to test the efficiency of different optimizing register allocation algorithms in different scenarios.
how do i start? what are the prerequisites and the grounds with which i can test them.
what all algos can i use?
-------------addition----------...
So I would call myself a fairly novice programmer as I focused mostly on hardware in my schooling and not a lot of Computer Science courses.
So I solved Problem 7 of Project Euler:
By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13.
What is the 10001st prime number?
I managed t...
Is there a disadvantage to using a dynamic Python file to generate the CSS for a webpage? I'd like computers with an administrator cookie to show special admin panel CSS, and show regular CSS for all other users. I'm planning to use:
<link rel="stylesheet" href="/css.py" type="text/css" />
...
I'm trying to vectorize a for loop that I have inside of a class method. The for loop has the following form: it iterates through a bunch of points and depending on whether a certain variable (called "self.condition_met" below) is true, calls a pair of functions on the point, and adds the result to a list. Each point here is an element i...
Hi folks,
How can I improve / speed up this frequent function?
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define M 10 // This is fixed
#define N 8 // This is NOT fixed
// Assumptions: 1. x, a, b and c are all arrays of 10 (M).
// 2. y and z are all matrices of 8 x 10 (N x M).
// Requirem...
I wonder what is the best C# data structure I should use to sort efficiently?
Is it List or Array or what?
And why the standard array [] does not implement sort method in it?
Thanks
...
Now comes the hard part. How do you optimize this function:
function coin_matrix($test, $revs) {
$coin = array();
for ($i = 0; $i < count($test); $i++) {
foreach ($revs as $j => $rev) {
foreach ($revs as $k => $rev) {
if ($j != $k &&
$test[$i][$j] != null &&
$tes...
Now we have a firebird database with 1.000.000 that must be processed after ALL are loaded in RAM memory. To get all of those we must extract data using (select * first 1000 ...) for 8 hours. What is the solution for this?
...
The title of this question isn't so clear, but the code and question is straightforward.
Let's say I want to show my users an ad once per day. To accomplish this, every time they visit a page on my site, I check to see if a certain memcache key has any data stored on it. If so, don't show an ad. If not, store the value '1' in that key ...
For example I have:
create table a (i int);
Assume there are 10k rows.
I want to count 0's in the last 20 rows.
Something like:
select count(*) from (select i from a limit 20) where i = 0;
Is that possible to make it more efficient? Like a single SQL statement or something?
PS. DB is SQLite3 if that matters at all...
UPDATE
PP...
I was trying to benchmark the gain/loss of "caching" math.floor, in hopes that I could make calls faster.
Here was the test:
<html>
<head>
<script>
window.onload = function()
{
var startTime = new Date().getTime();
var k = 0;
for(var i = 0; i < 1000000; i++) k += Math.floor(9.99);
var mathFloorTime = new Date().getTime() - s...
Hi!
I've recently come up with the idea to create a tag cloud like animation shaped like the earth. I've extracted the coastline coordinates from ngdc.noaa.gov and wrote a little script that displayed it in my browser. Now as you can imagine, the whole coastline consists of about 48919 points, which my script would individually render (e...
The guys who wrote Bespin (cloud-based canvas-based code editor [and more]) recently spoke about how they re-factored and optimize a portion of the Bespin code because of a misconception that JavaScript was slow. It turned out that when all was said and done, their optimization produced no significant improvements.
I'm sure many of us g...
hello.
I do some heavy numbercrunching and for me floating-point performance is very important.
I like performance of Intel compiler very much and quite content with quality of assembly it produces.
I am thinking at some point to try C++0x mainly for sugar parts, like auto, initializer list, etc, but also lambdas. at this point I use ...
Hi,
I am trying to get do this:
<?php
$good_customer = 0;
$q = mysql_query("SELECT user FROM users WHERE activated = '1'"); // this gives me about 40k users
while($r = mysql_fetch_assoc($q)){
$money_spent = 0;
$user = $r['user'];
// Do queries on another 20 tables
for($i = 1; $i<=20 ; $i++){
$tbl_name = 'd...