the script is in the bottom of the HTML source, we get it from Facebook developer API
I have to store a list of numpy matrices. Two approaches I tried:
1.Create a list and append to it:
for ind in range(iterations):
ls_ws.append(ls_w) # ls_w is a matrix of size 6,1
Problem: Fast at start, gets very slow at end... more
I know both Array List and Vector class in Java is a bad choice with multi threading. I knew Array List is not synchronised that's why not good with Multi Threading. I want to know the reason behind the poor performance of synchronised vector class i... more
If there are two actions and one has it's node in mvc.sitemap file and the other hasn't, action (view) without takes like 100x longer (5s vs 60ms) to render. To be clear: both work perfectly fine. It's just about performance.
Does the hardware prefetcher operate on contiguous virtual addresses, or is it operating on contiguous hardware addresses? Imagine the case where you have a large array of bytes which span multiple pages. In the virtual address space the bytes are co... more
I made a prime sieve in Haskell using mutable arrays. The two main mutable arrays are IOUArray and STUArray so I checked the performance with both.
On my computer the IOUArray runs five times faster than STUArray even though the code structure is pr... more
Suppose I have two NumPy matrices (or Pandas DataFrames, though I'm guessing this will be faster in NumPy).
array([[3, 1, 4],
[4, 3, 5],
[6, 5, 4],
[6, 5, 4],
[3, 1, 4]])
array([[3, 1,... more
I would like to develop a Spring REST backend application with tomcat.
I expect 1000-5000 active users. The users will create requests from clients(Android, web, Ios) to backend. Most of requests will create a simple db select.
How to calculate the... more
I like to work with classes and methods instead of bare functions. I am wondering if there is a specific performance impact to do so (either in execution speed, or memory usage or in other aspects).
A quick test shows that both perform equally well:... more
Suppose I'm using Oracle 11g, and have:
create table t1(
create view v1 as
select n1, n2 from t1;
In this case, if I ran:
select n1 from v1;
Will n2 be fetched from database? How can I confirm it? Thanks in advance!
Every time I'm coding I have dilemma between creating more variables and using methods, that make code more clear but less optimal? Can you tell me what is better for our application performance?
protected static <T> void exch(Li... more
Is there a significant difference between the efficiency of these two structures at large-scale (eg. wrapping each word in the Chinese-language Second World War Wikipedia article – which contains thousands of text-containing nodes – with ruby ann... more
In Wordpress using the W3 Total Cache plugin, should the .php files in /wp-content/cache/ get cached by the OpCache, or should they be blacklisted? There are a lot of those, causing the need for a much larger opcache.max_accelerated_files setting and... more
I have many classes on my application like Profile.cs, Post.Cs , Product.Cs and for database operations dbopertations.cs and businesslogic.cs
For example (for one method)
dboperations.cs inlcudes `
` public static List<Post> GetPost()
Am new to DB venture, I needed some help/information.
There is a table in our project say "record_table" , values in it is inserted using C++ code.
This table has multiple columns, out of which three columns say for eg. "serialNo, type... more
I am trying to significantly speed up the following code but to no avail. The code takes in a 2D array and removes rows of the array that, when compared to other rows in the array, are too similar. Please see below code and comments.
as0 = a.shap... more
How to get the exponential weighted moving average in numpy just like in pandas:
import pandas as pd
import pandas_datareader as pdr
from datetime import datetime
ibm = pdr.get_data_yahoo(symbols='IBM', start=datetime(2000, 1... more
How to make a rolling version of the following MAD function
from numpy import mean, absolute
def mad(data, axis=None):
return mean(absolute(data - mean(data, axis)), axis)
This code is an answer to this question
At the moment i convert nump... more
What I found:
I print the time cost of golang's copy, and it shows the first time of memory copy is slow. But the second time is much faster even I run "copy" on different memory address.
Here is my test codes:
func TestCopyLoop1x32M(t *testing.T)... more
I have an algorithm where my life would be greatly simplified if I could reserve about 20 blocks of memory addresses of size 4GB. In practice, I never use more than 4GB, but I do not know which block will fill up in advance.
If I mmap 20 blocks of 4... more
This is a high performance Python question:
My colleague gave me a list lFoos of instances of class Foo.
self.spam = random number
The list is huge and all I care about is t... more
I have two ways of testing for primes. One of them called isPrime and the other is isBigPrime. What I originally wanted is to test "big" primes with "small" primes that I have already computed, so that the testing becomes faster. Here are my implemen... more
As a Java dev, I'm currently looking at Go because I think it's an interesting language.
To start with it, I decided to take a simple Java project I wrote months ago, and re-write it in Go to compare performances and (mainly, actually) compare the c... more
Given 100,000 sequences of length 1000,
I am trying to calculate, for each m~[1, 1000], the percentage of sequences for which to following expression holds -
|(Mean of first m numbers in the sequens) - 0.25 | >= 0.1
The way the data was created... more
I have a table with 20 rows. Each row has a blob field that holds a txt file. Inside the text file is a million unique 10 digit numbers. How can I read and insert those numbers into another table in an efficient manner using oracle sql and plsql.
Say I have N contiguous arrays of the same size in C (or any other language - I guess it doesn't matter much). I want to loop over these arrays and perform some operation on each array element. This can be achieved by a single loop since all N arrays... more
I have a wordpress with woffice theme installed and WP Super Cache, only authenticated users can have access.
The problem is the webpage is too slow, when visiting any template without cache last about 7 seconds
The server is a VPS with 16GB ram an... more
I have a data.table with two columns of genes and each row treated as a pair. Some gene pairs are duplicated with the order reversed. I am looking for a faster method, preferably without using a loop like the one I've provided, to keep unique pairs i... more
If I have a Pandas dataframe, and a column that is a datetime type, I can get the year as follows:
df['year'] = df['date'].dt.year
With a dask dataframe, that does not work. If I compute first, like this:
df['year'] = df['date'].compute().dt.year
I'm concerned about performance and best practices.
So I'm building graphical UI and learned that I shouldn't call jQuery.append() a gazillion times when creating many small elements. So I got that covered by document.createDocumentFragment(). I'm ... more
I have a vector, a, which I wish to cross with every point in a defined 3D space.
import numpy as np
x = np.arange(-4,4,0.1)
y = np.arange(-4,4,0.1)
z = np.arange(-4,4,0.1)
a = [1,0,0]
result = [ for i in range(3)]
for j in range(len(x... more
I've seen a lot of threads here that compare and try to answer which is faster: newInstance or new operator.
Looking at the source code, it would seem that newInstance should be much slower, I mean it does so many security checks and uses reflection... more
I am just beginner in Haskell. And I writing a code to display the N numbers in the Fibonacci sequence. Here is my code in Haskell,
fib_seq 1 = 1:
fib_seq 2 = 1:1:
fib_seq n = sum(take 2 (fib_seq (n-1))):fib_seq (n-1)
When I run this code for ... more
I am writing a cython application where I need to generate a Gaussian random variable on-the-fly in a tight nested loop. I would like to do this without introducing any extra dependencies, e.g., on GSL.
For a minimal version of the way I am current... more
I have this idea to increase performance and I would be happy to get your opinion on whether this is good practice or not ?
Let's imagine I have "movie" objects that are rather expensive to build.
Now, let's say I have a view that displays 3 lists of... more