More optimizations
Here are some more easy optimizations discovered while benchmarking Metabase's usage of HoneySQL.
1. `clojure.string/split` uses the regex machinery which is generally more wasteful than searching for a substring manually. HoneySQL so far only looks for `.` when splitting names. Besides, plenty of names don't have `.` in them and they still pay the regex tax. The new splitter function allocates nothing in such case.
2. Clojure's Keyword object already contains a corresponding Symbol, so we can return it in `kw->sym` (if there is no namespace). We could actually just call `(symbol kw)` for the same effect, but I think this behavior was introduced in Clojure 1.10, and HoneySQL claims to support 1.9.
3. I again tried to address the into's transient-persistent roundtrip. This time, I'm not making any speculative and potentially damaging changes. There are a lot of places in the code where `into` is used multiple times in succession, hence `into*` (name is up to be changed) both makes the code cleaner and prevents unnecessary transient roundtrips inbetween.
合并状态:已合并 合并于 2025-01-01 关闭于 2025-01-01 6 条评论