Repository navigation
Releases: delphinus/luamigemo
Release list
v1.3.0
Performance
Major performance improvements to pattern generation, achieving up to 40x speedup on warm queries and matching or exceeding kensaku.vim (jsmigemo + denops IPC) performance.
Warm queries (dictionary caches populated)
| Input | v1.2.0 | v1.3.0 | Speedup |
|---|---|---|---|
"a" |
130ms | 3ms | 43x |
"jo" |
24ms | 1ms | 24x |
"joutai" |
0.6ms | 0.03ms | 20x |
Key optimizations
- Eliminate coroutine overhead — Replace
coroutine.wrap/yieldwith callback-based iteration, enabling LuaJIT JIT compilation of hot rank/select loops - Iterative AA-tree insertion — Convert recursive
insert_node/add_to_treeto iterative loops, enabling LuaJIT JIT compilation (previously caused NYI trace aborts) - Multi-level caching:
- Parent cache (FFI array) for LOUDSTrie
reverse_lookup - Reverse lookup result cache per trie node
- Mapping result cache per dictionary node (critical for incremental search)
- Flat search result cache per query key
- Query result memoization (repeated queries return in ~0.002ms)
- Parent cache (FFI array) for LOUDSTrie
- Pre-build parent cache at dictionary load time, shifting ~20ms from first query to load time
- Inline UTF-8 decoding in TernaryRegexGenerator, avoiding table allocation per word
- utf8_char result caching for repeated Unicode-to-UTF8 encoding
Compatibility
- jsmigemo pattern compatibility — Fix predictive romaji conversion to not recursively expand sokuon (っ). With the same dictionary, luamigemo now produces identical patterns to jsmigemo (only difference is kensaku.vim's
\mprefix).- Before:
じょう\%([たちつてと]\|っ[たちつてと]\) - After:
じょう[たちっつてと](matches jsmigemo)
- Before:
Benchmarks
Added benchmark and comparison scripts in bench/:
profile.lua— Internal phase-level profilingpractical_bench.lua— Diverse query benchmark (80+ queries, incremental typing simulation)compare_patterns.lua— Pattern output comparison vs kensakufind_differences.lua— Comprehensive pattern difference scanner
See bench/README.md for usage.
API
No breaking changes. All public APIs remain backward compatible.
v1.2.0
Changes
set_rxop() を廃止し、query() の引数で rxop を指定する方式に変更
set_rxop() はシングルトンインスタンスの状態を変更するため、異なる箇所から get() で取得したインスタンス全てに影響してしまう問題がありました。
この変更により、rxop は query() のオプション引数として渡す方式になりました。インスタンスの状態を汚さず、呼び出しごとに正規表現方言を指定できます。
Before:
local m = migemo.get()
m:set_rxop(migemo.RXOP_VIM)
local pattern = m:query("tokyo")After:
local pattern = migemo.query("tokyo", migemo.RXOP_VIM)rxop を省略した場合のデフォルトは従来通り RXOP_PCRE です。
v1.1.1
Documentation
- lazy.nvim のプラグインスペック例に
version = "*"を追加し、リリースバージョンへの固定を推奨するようにしました。
What's Changed
- Updated lazy.nvim plugin spec examples in both README.md and README.ja.md to recommend pinning to release versions with
version = "*"for stability.
Full Changelog: v1.1.0...v1.1.1
v1.1.0
Simplify M.query() API
M.query() now takes only a word argument. Dictionary and regex operator configuration is done through the instance API.
Before
local migemo = require "luamigemo"
local pattern = migemo.query(nil, "kensaku", migemo.RXOP_PCRE)After
local migemo = require "luamigemo"
local pattern = migemo.query("kensaku")Customizing regex dialect or dictionary
Use migemo.get() to create an instance with full control:
local m = migemo.get() -- bundled dict
m:set_rxop(migemo.RXOP_VIM) -- Vim regex
local pattern = m:query("kensaku")
-- Or with a custom dictionary
local m = migemo.get("/path/to/dict")
m:set_rxop(migemo.RXOP_PCRE)
local pattern = m:query("kensaku")v1.0.0
luamigemo v1.0.0
Pure Lua migemo engine for LuaJIT — romaji to regex converter for Japanese text search.
Features
- Romaji input to regex pattern conversion matching hiragana, katakana, and kanji
- BSD-licensed dictionary bundled — works out of the box with zero configuration
- PCRE and Vim regex dialect support (
RXOP_PCRE/RXOP_VIM) - No
vim.*dependency in core — runs on any LuaJIT environment - Singleton instance with dictionary caching for efficient repeated queries
- Predictive search with camelCase-aware query parsing
- Full/half-width and hiragana/katakana character conversion
:checkhealth luamigemosupport for Neovim
Install
-- lazy.nvim
{ "delphinus/luamigemo" }# LuaRocks
luarocks install luamigemoUsage
local migemo = require "luamigemo"
local pattern = migemo.query(nil, "kensaku", migemo.RXOP_PCRE)
-- => (?:kensaku|けんさく|ケンサク|検索|...)Acknowledgements
Ported from oguna/jsmigemo. Dictionary data from oguna/yet-another-migemo-dict (BSD 3-Clause).