Python vs. Julia with deeply nested dictionaries

Поділитися
Вставка
  • Опубліковано 25 лип 2024
  • When creating a deeply nested dictionary, which is faster: Python or Julia? That's the question I seek to answer in this video, within the context of implementing the MERGE-multidimensional algorithm proposed here:
    journals.openedition.org/lexi...
    Here's my Python script:
    github.com/ekbrown/scripting_...
    Here's my Julia script:
    github.com/ekbrown/scripting_...
    #python # python3 #pythonprogramming #julialang

КОМЕНТАРІ • 8

  • @exxzxxe
    @exxzxxe 23 дні тому

    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  23 дні тому

      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.

  • @alextantos658
    @alextantos658 Місяць тому +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  Місяць тому +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 Місяць тому

      @@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  23 дні тому

      Here's a quick comparison with a simple frequency dictionary: ua-cam.com/video/ROgQASMN_lI/v-deo.html

  • @oterotube13
    @oterotube13 18 днів тому +1

    So at the end is Julia vs. C

    • @ekbphd3200
      @ekbphd3200  14 днів тому

      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.