Web Performance API includes fileSize?

i just started to create RUM script: im using window.performance javaScript object window.addEventListener('unload', logData, false); function logData() { var body = {}; body.timestamp = Date.now(); body.operatingSystem = navigator.plat...
more »

2017-06-18 11:06 (0) Answers

Python: The function trend to be slow

I need to call a function in for loop. In the first about 200 iteration, the function cost about 0.2s each time. However, the function will cost about 13s each time after 200 iteration. Just like: time cost: 0.194762, 55.968955~56.163716 290 time co...
more »

2017-06-17 11:06 (0) Answers

Nested rolling sum in vector

I am struggling to produce an efficient code to compute the vector result r result from an input vector v using this function. r(i) = \sum_{j=i}^{i-N} [o(i)-o(j)] * exp(o(i)-o(j)) where i loops (from N to M) over the vector v. Size of v is M&...
more »

2017-06-15 14:06 (2) Answers

Improve Looping Efficiency in VBA

I have a For loop that loops through integers 1 to 9 and simply finds the bottom most entry that corresponds to that integer ( i.e. 1,1,1,2,3,4,5 would find the 3rd "1" entry) and inserts a blank row. I concatenate the number with a string "FN" that ...
more »

2017-06-15 13:06 (2) Answers

Neo4j cache and performance

I'm testing a query in neo4j and I see that when I clear the cache . Neo4j takes more time to load . which mean performances are dicreasing . Why is this happening I don't know now whether to clear the cache for each query ? or should I just test w...
more »

2017-06-15 12:06 (1) Answers

Apply Numpy to "for loops"

import numpy as np c=[10,2000] # only two index for example horizontal=[] vertical=[] for i in range(0,c[0]): for j in range(0, c[1]): horizontal.append(j) vertical.append(i) print horizontal When I am working with arrays a...
more »

2017-06-12 14:06 (1) Answers

Why is `speedglm` slower than `glm`?

I am trying to use speedglm to achieve a faster GLM estimation than glm, but why it is even slower? set.seed(0) n=1e3 p=1e3 x=matrix(runif(n*p),nrow=n) y=sample(0:1,n,replace = T) ptm <- proc.time() fit=glm(y~x,family=binomial()) print(proc.tim...
more »

2017-05-26 20:05 (1) Answers

vectorise for loop with numpy.where

>>> a = np.array([1, 1, 2, 3, 3, 4, 5]) >>> b = np.array([1, 3, 4, 5]) >>> indices = np.zeros((len(a))) >>> for i in range(len(a)): try: indices[i] = np.where(b == a[i])[0][0] except: indice...
more »

2017-05-26 11:05 (2) Answers

Calculate histograms along axis

Is there a way to calculate many histograms along an axis of an nD-array? The method I currently have uses a for loop to iterate over all other axes and calculate a numpy.histogram() for each resulting 1D array: import numpy import itertools data = ...
more »

2017-05-24 10:05 (1) Answers

how to fix rollover with python data

Let's say I've got this csv file that I want to import and graph in python using pyplot and pandas. 1,2 2,4 3,3 4,4 5,6 6,3 7,5 8,6 1,3 2,5 3,7 4,4 5,3 6,5 7,4 8,5 1,3 2,2 3,5 4,4 5,3 6,5 7,6 8,7 As you can see, column 1 rolls over at the number 8...
more »

2017-05-21 04:05 (3) Answers

Function executes faster on subsequent runs

I was playing with performance.now() and wrote a simple recursive function to calculate the factorial of a number when I ran into some interesting observations. The following code finds the factorial of a number and logs the time it took for the fun...
more »

2017-05-20 15:05 (0) Answers

Difference between protractor and jQuery selector

Is there any difference between the jQuery selector and the protractor selector. I know that for basic element selection like grabbing a div or paragraph both works fine but do we have a use case where protractor supersede jQuery selector and any spe...
more »

2017-05-18 21:05 (0) Answers

Optimize Multiple database update

I am using laravel in my app. So now I need to update many rows on DB once a day with Cron job. If I will use the update option built-in laravel I need to do something like this: // for example, the update info in array $arrayToUpadte = [ [ ...
more »

2017-05-14 02:05 (1) Answers

best way to evaluate react js app performance

I have huge react app with 50 routes and almost 3000 components. now my question is, how can I check is my app performing well? which modules are taking time. total app's performance indicator how to identify. what are the best tools in the market? ...
more »

2017-05-13 10:05 (1) Answers