Optimize Iterable<Map>.toDataFrame conversion#1635
Conversation
… Map->Row, collect values directly into columns
| val list = asList() | ||
| if (list.isEmpty()) return DataFrame.empty() | ||
|
|
||
| val allKeys = linkedSetOf<String>() |
There was a problem hiding this comment.
:o TIL what a linked HashSet is
There was a problem hiding this comment.
though, it seems mutableSetOf produces the same thing in Kotlin :) so I thought all sets behaved this way. Still it's nice to be expressive :D
|
I wonder... could we do the same trick with Currently, it's only optimized when all DataRows originate from the same DF, but else it just calls Actually, we can just call |
Lol. How tables have turned! Yes, i'm positively surprised by how relatively straightforward this is, at least without recursive value conversion. With DataRow we probably need to create nested column groups, so it will be a bit trickier |
ah yes, of course! let's do that separately :) I like this recent performance-improvement-trend ;P |
Now it hits a lot of heavy reflection calls like
type.isSubtypeOf<AnyRow?>(),AnyFrameon eachMap -> DataRow.Collecting values first, inferring type for all gives a visible improvement
17 s -> 1.5 s
Code i used for testing:
fixes #90