Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Compress hash displace algorithm for faster Julia dictionaries

License

NotificationsYou must be signed in to change notification settings

Arkoniak/CompressHashDisplace.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DocumentationBuild Status
StableDevBuildCoverage

This package creates read-only dictionaries with fast access speed.

Installation

julia> ] add CompressHashDisplace

Usage

using BenchmarkToolsusing CompressHashDisplaceDICTIONARY="/usr/share/dict/words"dict=Dict{String, Int}()for (line, word)inenumerate(readlines(DICTIONARY))    dict[word]= lineendfrozen_dict=FrozenDict(dict)frozen_dict["hello"]# 50196frozen_unsafe_dict=FrozenUnsafeDict(dict)frozen_unsafe_dict["hello"]# 50196word="hello"@btime$dict[$word]# 76.615 ns (0 allocations: 0 bytes)@btime$frozen_dict[$word]# 60.028 ns (0 allocations: 0 bytes)@btime$frozen_unsafe_dict[$word]# 22.124 ns (0 allocations: 0 bytes)

Main difference betweenFrozenDict andFrozenUnsafeDict is thatFrozenUnsafeDictdo not validate input key

frozen_dict["foo"]# KeyError: key "foo" not foundfrozen_unsafe_dice["foo"]# 59716, i.e. some random value

About

Compress hash displace algorithm for faster Julia dictionaries

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors3

  •  
  •  
  •  

Languages


[8]ページ先頭

©2009-2025 Movatter.jp