Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

メモ化による処理の高速化 #50

Merged
merged 1 commit into from
Nov 20, 2020
Merged

メモ化による処理の高速化 #50

merged 1 commit into from
Nov 20, 2020

Conversation

uribo
Copy link
Owner

@uribo uribo commented Nov 20, 2020

Summary

memoiseパッケージを利用。メッシュコードの変換処理はキャッシュを効かせて高速化する。市町村コードの抽出もキャッシュ。

対象の関数

  • administration_mesh()
  • meshcode_set()
  • export_mesh() (export_meshes())

比較

メモ化前
library(jpmesh)
tictoc::tic()
administration_mesh(code = "35201", to_mesh_size = 1)
tictoc::toc()
#> 6.894 sec elapsed

tictoc::tic()
m <- 
  meshcode_set(10, .raw = FALSE)
tictoc::toc()
#> 7.608 sec elapsed

tictoc::tic()
export_meshes(m)
tictoc::toc()
#> 94.976 sec elapsed
メモ化後
pkgload::load_all()
tictoc::tic()
administration_mesh(code = "35201", to_mesh_size = 1)
tictoc::toc()
#> 1.382 sec elapsed

tictoc::tic()
m <- 
  meshcode_set(10, .raw = FALSE)
tictoc::toc()
#> 0.012 sec elapsed

tictoc::tic()
export_meshes(m)
tictoc::toc()
#> 8.695 sec elapsed

Related issues

なし

@uribo uribo merged commit a974656 into master Nov 20, 2020
@uribo uribo deleted the feature/memoise branch November 20, 2020 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant