RFC: clean up map and collect with iterator traits#15123
RFC: clean up map and collect with iterator traits#15123JeffBezanson wants to merge 27 commits intojb/generatorsfrom
map and collect with iterator traits#15123Conversation
hey, every bit helps.
when the matrices have the same size we can get away with simple copying of the internal fields.
map and collectmap and collect with iterator traits
578ca47 to
5c29840
Compare
cceec88 to
a15abf4
Compare
|
+1. Does this mean we could have a correctly typed unzip as well? On Wednesday, February 17, 2016, Jeff Bezanson notifications@github.com
|
some tweaks to code for the EnvHash type
and adjurst the tolerance. Fixes #14778
a few more micro-optimizations to parsing
patches #13682 to fix memory mapping of large files on Windows
add specialized copy! for sparse matrices
[WIP] Clarify section about Base.convert fall-back.
Fixes #14002 The primary problem was the lack of a space at the end of the regexp, which didn't match the output of the shell process (does have a space). This meant that emacs sometimes placed the point one character before the end of the buffer, which prevented M-p from working. This new regexp also allows for other prompts, such as "shell> "
5c29840 to
8962053
Compare
julia-mode: Add space to prompt regexp
RFC: added os_only documentation
Reenable test of condition number estimates of sparse matrices
8962053 to
bc0956b
Compare
Added tests to increase coverage in base/rationals.jl
mmap: remove unnecessary use of utf16
RFC: generator expressions
a15abf4 to
dc593ad
Compare
This is a proposal for cleaning up our iteration, mapping, and collecting. Between
copy[!],collect,map, and comprehensions we had subtly different behaviors for similar operations. We also had some repeated code and inefficient generic fallbacks.This change replaces all that with
collectof various iterators. There are four core algorithms for this, based on whether an iterator has a known length/shape and whether it has a known element type. To select the right algorithm, I added some HolyTraits for iterators. I seem to recall iterator traits being discussed before, but I can't find a reference.The biggest immediate benefit is that generic
mapis faster and better-typed.Before:
giving a
Vector{Any}.After:
giving a
Vector{Tuple{Int64,Tuple{Int64,Int64}}}.This is achieved with the following glorious definition(s):
This definition is almost as fast as existing array functions:
Hopefully this gap can be closed.
A major issue here is iterator shape preservation. Some iterators just wrap others and so should obviously preserve their shape, like
Generator. Others are less obvious. Since zipped iteration is so common when working with arrays, I madezipshape-preserving.productis currently 1d only, but could for example concatenate the shapes of its component iterators.