Python vs. Julia with deeply nested dictionaries

แชร์
ฝัง
  • เผยแพร่เมื่อ 5 ม.ค. 2025

ความคิดเห็น • 8

  • @oterotube13
    @oterotube13 6 หลายเดือนก่อน +1

    So at the end is Julia vs. C

    • @ekbphd3200
      @ekbphd3200  5 หลายเดือนก่อน

      I guess. I don't know how Python's for loops compare to C's, but I guess the dictionary itself is implemented in C.

  • @alextantos658
    @alextantos658 6 หลายเดือนก่อน +1

    And ome could also try out the Dictionaries.jl package in Julia that is much more performant and efficient than he base Julia Dict type.

    • @ekbphd3200
      @ekbphd3200  6 หลายเดือนก่อน +1

      Thanks for the idea. I just tried Dictionary.jl to get the frequencies of words across 40k files with 230m words, and it was only slightly faster than Base.Dict (47s vs. 51s). I'll have to implement Dictionary.jl with a deeply nested dictionary and see how it does.

    • @alextantos658
      @alextantos658 6 หลายเดือนก่อน

      @@ekbphd3200 ​
      Thanks for the nice videos and the work! Besides Dictionary.jl, Julia offers several other options from DataStructures.jl, such as SwissDict and other data structures that are claimed to be faster. What I appreciate about Julia is its diverse range of options, often re-implemented within the language itself without needing to track/tune C implementations of basic operations.. Therefore, while comparing base types between languages provides valuable insights, it doesn't fully capture the extent of Julia's capabilities. PS: I am a Python user and fan too..

    • @ekbphd3200
      @ekbphd3200  6 หลายเดือนก่อน

      Here's a quick comparison with a simple frequency dictionary: th-cam.com/video/ROgQASMN_lI/w-d-xo.html

  • @exxzxxe
    @exxzxxe 6 หลายเดือนก่อน

    This is the second time I have viewed this video. Thank you for performing the benchmark-testing work I would have had to do- saved me quite a bit of time. Now a question: Do you believe Mojo will progress to point where its dictionary performance will equal or exceed Python's?

    • @ekbphd3200
      @ekbphd3200  6 หลายเดือนก่อน

      You're very welcome! I'm glad that enjoyed it.
      I hope and assume Mojo's native dictionary will get faster with future releases. In the changelog for Mojo v.24.4 the creators say: "Significant performance improvements when inserting into a Dict. Performance on this metric is still not where we'd like it to be, but it is much improved." docs.modular.com/mojo/changelog#v244-2024-06-07
      With the "still not where we'd like it to be" I assume that they will continue to work on the native dictionary.