Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #29674

Re: library for fast map/filter/reduce

Newsgroups comp.lang.javascript
Date 2016-02-23 19:22 -0800
References <9f70cd71-da91-478c-ac97-392fcb7c7a63@googlegroups.com>
Message-ID <ea3fa9d4-d683-4081-a605-14d084d2a430@googlegroups.com> (permalink)
Subject Re: library for fast map/filter/reduce
From "Michael Haufe (TNO)" <tno@thenewobjective.com>

Show all headers | View raw


On Wednesday, February 17, 2016 at 12:24:58 AM UTC-6, glathoud wrote:
> Hello,
> 
> I'd like to share a library that permits to write map/filter/reduce code that runs much faster than the corresponding native Array methods. 

This of course depends on the implementation. A sufficiently intelligent one can accomplish comparable speed. For example, take a look at the newer implementations of Firefox [1]

> It works by generating fast JS code automatically, with a single for loop whenever possible, and also includes logical functions and object/array conversions functions.
> 
> http://glat.info/transfun/

It seems like you've rediscovered something similar to the fold-fusion laws [2][3]. It's good to see someone play with this in JavaScript again, though I'm not a fan of your syntactic approach of using string literals... When I played with similar in the past (LINQ implementation on top of iterators/generators), I was using the following to represent the expressions:

function sum(a,b){ return a + b; }

var query = xs.select('p').where({ne:null}).reduce(sum)
...
query() //call the query

If I was to revisit this again, I think I would look at the recent efforts of Asen Bozhilov on ES-Iter [4] combined with a re-read of a few of the fold-fusion papers.

Overall though, I have a positive opinion of your efforts.

[1] <http://jsperf.com/arr-map-filter-reduce/5>
[2] <http://www.cs.nott.ac.uk/~pszgmh/fold.pdf>
[3] <https://www.cs.ox.ac.uk/ralf.hinze/publications/IFL10.pdf>
[4] <https://github.com/abozhilov/ES-Iter>

Back to comp.lang.javascript | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

library for fast map/filter/reduce glathoud <glathoud@yahoo.fr> - 2016-02-16 22:24 -0800
  Re: library for fast map/filter/reduce Scott Sauyet <scott.sauyet@gmail.com> - 2016-02-18 20:01 -0800
    Re: library for fast map/filter/reduce glathoud <glathoud@yahoo.fr> - 2016-02-19 02:10 -0800
      Re: library for fast map/filter/reduce Scott Sauyet <scott.sauyet@gmail.com> - 2016-02-19 08:44 -0800
        Re: library for fast map/filter/reduce glathoud <glathoud@yahoo.fr> - 2016-02-20 04:03 -0800
          Re: library for fast map/filter/reduce Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-02-20 13:59 +0000
            Re: library for fast map/filter/reduce glathoud <glathoud@yahoo.fr> - 2016-02-23 21:53 -0800
  Re: library for fast map/filter/reduce "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-02-23 19:22 -0800
    Re: library for fast map/filter/reduce glathoud <glathoud@yahoo.fr> - 2016-02-23 22:11 -0800

csiph-web