ES6 Tail Recursion Optimisation Stack Overflow

Having read Dr Rauschmayer's description of recursive tail call optimisation in es6, I've since been trying to recreate the 'zero-stack' execution of the recursive factorial function he details. Using the Chrome debugger to step between stack frames,...
more »

2017-03-14 15:03 (1) Answers

Optimize Case Statement

We have a method for writing command data to a device. The method first converts the data to the form accepted by the device and then writes the data to the serial port. The data conversion is done with a case statement as given below. For 10 command...
more »

2017-03-08 15:03 (5) Answers

Python scipy optimization does not find minimum

Trying to use scipy.optimize.minimize, it seems like the optimization fails. I did the following: 1. The objective function is: f(x)= x[0]+x[1]+x[2]+x[3]+10 2. The constraint is: x_i >= 0 3. The initial guess is: x0 = [1,1,1,1] Very trivial proble...
more »

2017-03-03 20:03 (1) Answers

Speed up the lookup procedure

I have two tables: coc_data and DT. coc_data table contains co-occurrence frequency between pair of words. Its structure is similar to: word1 word2 freq 1 A B 1 2 A C 2 3 A D 3 4 A E 2 Second tabl...
more »

2017-02-27 11:02 (1) Answers

Adding context to rewrite rules

In the following code, I want to rewrite g . f as h when possible. There may be cases h hasn't got the instance of class, but I'd like to do the rewrite when it's possible. I'm getting an error message suggesting this is achievable but I'm not sure e...
more »

2017-02-17 10:02 (1) Answers

Optimized way to cache a list of results?

This is a question for PHP/Laravel + Redis, but I'm sure it can be extrapolated to other languages/frameworks. I'm working on an app that displays a results (either from a user initiated search or category listing). By default, we paginate 30 resul...
more »

2017-02-16 22:02 (1) Answers

Iteration with creating a new DOM element

I have a problem on high load iteration. CommonMethods.showLoader(); var html = $("<div>"); for (var i = 0, length = folder.tracks.length; i < length; i++) { var clone = Track.create(folder.tracks[i], folder.folder_id); ...
more »

2017-02-13 13:02 (0) Answers

Server Response Time

I'm trying to decrease my server response time but can't understand why that doesn't drops. here's my website's result: https://gtmetrix.com/reports/www.mutlugunsusleri.com/gAZ9pUPc I used w3 total cache, maxcdn and optimized photos. but there's a ...
more »

2017-02-11 08:02 (0) Answers

A better 8x8 bytes matrix transpose with SSE?

I found this post that explains how to transpose an 8x8 bytes matrix with 24 operations, and a few scrolls later there's the code that implements the transpose. However, this method does not exploit the fact that we can block the 8x8 transpose into f...
more »

2017-02-10 15:02 (3) Answers

How 'smart' is GCC's Tail-Call-Optimisation?

I just had a discussion where the following two peices of C code were being discussed: For-Loop: #include <stdio.h> #define n (196607) int main() { long loop; int count=0; for (loop=0;loop<n;loop++) { count++; } printf("Resu...
more »

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

how does redundant if-else help to optimize?

I am reading the source code of Python's numpy library, and found the following snippets. It seems to perform element-wise operations on vectors (numpy.ndarray). For example, numpy.multiply([1,2,3],[4,5,6]) will get the result [4,10,18] #define BASE...
more »

2017-02-09 08:02 (2) Answers