Skip to content

Why is Mojo's dictionary (or for loop) slower than Python's? #1747

Closed Locked Answered by soraros
ekbrown asked this question in Q&A
Discussion options

You must be logged in to vote

In your case, my guess is that it is memory allocation that takes the most time, because String doesn't have small string optimisation.

Notice large part of Mojo's standard library is still WIP. Dict for one, is only introduced in 0.7.0 (the latest version), and it's more "place holder" to make sure things mash together than being fully optimised implementation. Introduce them early helps getting the API right, and can serve to replace the many hand rolled implementation by the community. There are both minimal hand-rolled hash map and hash function that perform better than the standard library ones, which proves my point. Notice Mojo is a system programming language like C++ and Rust. It…

Replies: 3 comments 5 replies

Comment options

You must be logged in to vote
3 replies
@soraros
Comment options

@wiseaidev
Comment options

@soraros
Comment options

Comment options

You must be logged in to vote
2 replies
@ekbrown
Comment options

@ekbrown
Comment options

Answer selected by ekbrown
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants