The former is all about speech synthesis and I’ve seen much interest in this area. There will be game-changing applications and we are now past the time of robotic interaction voices of the sci-fi movies. The latter is about getting new backcloth to convolutional neural networks based on graphs. Hm… always an interesting read.
Interesting links in this collection today, namely PyML by Uber. It has become important to understand what they are doing right here as the world is moving fast in ML domains. And they are using Python. The FB links are of particular interest because of their application fields (NLP and audio systems). I’m interested in these two topics right now and was a surprise to come about this research.
Drawing Images With CSS Gradients — HTML and CSS are so mature now that they are becoming a fun playground. Animations, transitions, drawing images… you name it.
Are we stuck with cement? How one of the biggest industries in the world is not doing its part in getting a sustainable environment. Read and think about it. You next sustainable project might not be as clean as one thinks.
functionf1(z) { let len = z; let buff = [] for (let i = 0; i < len; i++) { buff[i] = i; } return buff; }
functionf2(z) { let len = z; let buff = [] while (len--) { buff[len] = len; } return buff } tic(); f1(2 << 20); toc(); tic(); f2(2 << 20); toc();
Your Results:
Normally I would say that the reversed while would be faster. It has been in other instances. But in this case we want to create an array with numbers from 0 to z-1. In this case the for loop is much faster (tested in Chrome, Firefox, Opera). What is going on? Is it a caches problem where JS engines expect the “straight” order and not the reverse one?
update
What if we pre-allocate the size of the buffer before iterating over it as in function f2. This would lead to the new function f2_new
1 2 3 4 5 6 7 8 9
functionf2_new(z) { var len = z; var buff = []; buff.length=len; while (len--) { buff[len] = len; } return buff; }
Notice that I’m creating a buffer with the correct length before looping over it. If you run this version you’ll get the fastest while loop.
This version is now on par with the for loop and in some benchmarks it is substantially faster. So, order restored in the realm of Javascript. Me happy again.