Conversation
699cf37 to
2da3789
Compare
b8f7a9b to
fe773b1
Compare
lua/sql/defs.lua
Outdated
| local M = {} | ||
|
|
||
| local clib = ffi.load('/usr/lib/libsqlite3.so') | ||
| local clib_path = vim.g.sql.clib_path or (function() |
There was a problem hiding this comment.
btw shoudn't that be vim.g.sql_clib_path
There was a problem hiding this comment.
hmm, I think we need to have a configurable table so later we have room to add another optional configurations, think db url, auth ..
Thats might be a bad idea when there is multiple plugin in using sql.nvim. @Conni2461
There was a problem hiding this comment.
I think it might be good to use while loop here that iterate over a list, say possible_paths
There was a problem hiding this comment.
Yeah but how many possible paths are there. Its usually /usr/lib and /usr/lib64 is most just a symlink.
So for some older system it might be /usr/lib32 but then that would be symlinked to /usr/lib
There was a problem hiding this comment.
I think its a handful but we can only know that with users testing it. Also, we can add a condition that say if no path is found, then just assume that the lib is linked statistically. And this we can do by passing through "sqlite3"
There was a problem hiding this comment.
But statically linked means for us. Statically linked against neovim :o
So what should i do? vim.g.sql. and vim.g.sql.clib_path or function
and we iterate over it later?
Before lazy was default and there was no way of changing that. I've
decided to make it optional because it seems that:
1. People expects sqlite {} or sqlite:extend {} to create all the
defined table in advance.
2. Performance impact of initializing db object is only 1.0 slower in
microseconds, so it seems to not be as important as I thought it
would:
```lua
-- test/lazy.lua
Benchmark #1: 'Logical Component'
Time(mean ± σ): 23.7 μs ± 18.7 μs
Range(min … max): 17.4 μs … 102.3 μs 20 runs
Benchmark #2: 'Full Initialization'
Time(mean ± σ): 28.7 μs ± 12.9 μs
Range(min … max): 24.1 μs … 83.1 μs 20 runs
Summary
'Logical Component' ran
1.2 ± 1.1 times faster than 'Full Initialization'
```
No description provided.