Git Product home page Git Product logo

Comments (1)

namjals avatar namjals commented on June 26, 2024

결과 (Trie vs Dictionary)

  1. 인덱싱
  • 4MB의 명사 문서를 인덱싱하는데 걸리는 시간
  • Dictionary
    1.51 s ± 66.3 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
  • Trie
    19.8 s ± 291 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
  • 13배 느림 (19.8 s/ 1.51 s).
  1. 검색
  • 다음 9개의 단어 검색하는데 걸리는 시간
    words = ['프로', 'c++', 'c#', 'c', '프로그래밍', '야근', '하드웨어', '저수준', '포프']
  • n : 인덱스 단어 수, m : 검색 단어 길이
  • Dictionary
    -. 검색어와 인덱스가 일치하는 검색, O(1)
    806 µs ± 13.6 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)
    -. 검색어로 시작하는 인덱스 검색, O(n)
    29 ms ± 482 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)
  • Trie
    -. 검색어로 시작하는 인덱스 검색, O(m)
    1.42 ms ± 20 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)
  • 20배 빠름 (29 ms/1.42 ms).
  1. 결론
  • Trie가 Dictionary 대비 인덱싱은 13배 느리고 검색은 20배 빠르다.
  • 문서의 양이 적을 때는 Dictionary, Trie의 검색 속도는 체감상 차이가 안난다.
  • 테스트 단계에서는 인덱싱이 빠른 Dictionary를 사용하고 실 사용 단계에서는, 문서의 양이 많아지면 Trie를 고려해보자.

from youtube_caption_analyzer.

Related Issues (1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.