Comparing the speed of startswith() .vs. in()

I was under the impression that startswith has to be faster than in for the simple reason that in has to do more checks (allows for the word being looked for to be anywhere in the string). But I had my doubts so I decided to timeit. The code for the ...
more »

2017-06-13 13:06 (3) Answers

Optimizing Knockout / TKO - Alpha3

In the process of modernizing Knockout for version 4.0 (now live at the monorepo tko), I've hit some performance issues. Among other changes, some inner-loop things have been converted to ES6 classes, and it's causing some major performance problems...
more »

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

In what scenarios libgit2 is faster than git?

I can write a Zsh module with some subset of git-command features. The motivation is to accelerate prompts. Example prompt that I use does: changed_files=() git diff --quiet 2> /dev/null || changed_files=(${(f)"$( git diff --name-only 2&g...
more »

2017-06-03 05:06 (1) Answers

AngularJS unusually high memory consumption

I have an AngularJS application that renders around 200-250 elements . Each of the repeated elements contains inner items , and some of them have nested ng-repeats. On running, the JS Heap memory allocation was around 70MB which caused the webpage o...
more »

2017-05-30 14:05 (2) Answers

Tensorflow: simultaneous prediction on GPU and CPU

I’m working with tensorflow and I want to speed up the prediction phase of a pre-trained Keras model (I'm not interested in the training phase) by using simultaneously the CPU and one GPU. I tried to create 2 different threads that feed two diffe...
more »

2017-05-30 08:05 (1) Answers

Efficient row wise matrix operation in R

I have 2 matrices M1, M2. For each row in M1, I want to find the maximum value of the product of that row in M1 and each row in M2. I have tried the following implementation which produces the result I want. set.seed(1) st_time = Sys.time() M1 = m...
more »

2017-05-28 21:05 (2) 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

How to improve the speed of xlwings UDFs in Excel?

In Python 3, I'm using UDFs in Excel via xlwings to compute a formula. The formula is computed over 4000 times and it takes about 25 seconds to refresh the worksheet. The formula below is used as an example. The formula is called in Excel in each Exc...
more »

2017-05-26 16:05 (0) Answers