-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
'list::sort' is very slow #710
Comments
I was bored today so I spent some time investigating on current 1. A Quick Fix (
|
See issue #710 for context and analysis
Warning
My measurements are, well, not great (ran only once), but I think they are good enough to showcase the trendline.
I did try to run the native sort first and only then the Effekt sort just to make sure.
I tried to use
list::sort
onList[Int]
in order to sort a few hundred thousand relatively small numbers and, well, it was quite hard to do so on both the JS and the LLVM backend.So I went ahead and tried measuring it in comparison with doing a native sort on the JS backend (converting a list to an array and then building it back up). The trendline clearly shows that Effekt's sort is pretty darn slow, especially in the case of relatively small numbers:
Of course, the implementation of
sort
is currently pretty simple:effekt/libraries/common/list.effekt
Lines 652 to 665 in adf76cf
but I think it would be nice to look into it and try to speed it up.
I don't think we need to be competitive with a mutable array in JS, but for my usecase it would be nice if this particular difference wouldn't be so huge. I'm fine with it taking -- let's say, 100ms -- but 17s is kinda a lot, even for linked lists:
As an alternative, we could also provide
array::sort
(ideally written in Effekt though).Here's the code I measured with
The text was updated successfully, but these errors were encountered: