since toEdge is called lots of times, we think it is worth to optimize.
This is what @daewon reported
based on profile, we can notice that toMap on list and ++ on two list takes many cpu time on toEdge.
we can avoid toMap and ++ by using mutable map and give up functional style here. I think code looks ugly(not too bad), but we can remove unnecessary cpu usage. I would be minor tuning but toEdge is called many many times(called once on every fetched edges).
since toEdge is called lots of times, we think it is worth to optimize.
This is what @daewon reported
based on profile, we can notice that toMap on list and ++ on two list takes many cpu time on toEdge. we can avoid toMap and ++ by using mutable map and give up functional style here. I think code looks ugly(not too bad), but we can remove unnecessary cpu usage. I would be minor tuning but toEdge is called many many times(called once on every fetched edges).