-
Notifications
You must be signed in to change notification settings - Fork 21
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
use of in-set
makes thing slower
#17
Comments
Thanks, I'll fix it but I'd say this is a bug with Racket. Using |
@samth Actually, I'm not seeing any slowdown (with my existing tests). Are you using with Typed Racket? Do you have an example? |
This did come from typed racket, where the |
Strangely, I get slower times (by ~15%) without Without
With
The test is:
where |
I pushed the test if you want to try it. |
Somehow I'm unable to run it properly, but what if you take out the |
I changed the test to
and I get the same (faster) times as above. |
This behavior is consistent with my past experience. Relying on the implicit conversion is generally slower. |
Right, but the call to |
I don't understand this. It is faster with the call to |
Right, it is, but not much. Consider these three loops:
The third one will be much faster (about 5x by my count). Then do the same for sets. They're all about 10x slower than the slow list ones, and the same speed. So |
Oh I understand now. You're talking about |
I guess it's because "sets" are generic? |
Yes, but either that could work better, or we could have |
Agreed. I'll look into it. |
Started a pull request: racket/racket#1199 |
Right now, the
in-neighbors
sequence unnecessarily features a call toin-set
, which wraps the set in an opaque sequence. Sets are sequences, so this isn't necessary, and makes everything slower.The text was updated successfully, but these errors were encountered: