refactor: small perf win by eliminating string object keys
This commit is contained in:
parent
db60c32d93
commit
4a4e0f4013
12 changed files with 151 additions and 111 deletions
|
|
@ -1,5 +1,6 @@
|
|||
local cache = require("oil.cache")
|
||||
local config = require("oil.config")
|
||||
local constants = require("oil.constants")
|
||||
local fs = require("oil.fs")
|
||||
local files = require("oil.adapters.files")
|
||||
local loading = require("oil.loading")
|
||||
|
|
@ -8,9 +9,10 @@ local sshfs = require("oil.adapters.ssh.sshfs")
|
|||
local pathutil = require("oil.pathutil")
|
||||
local shell = require("oil.shell")
|
||||
local util = require("oil.util")
|
||||
local FIELD = require("oil.constants").FIELD
|
||||
local M = {}
|
||||
|
||||
local FIELD_META = constants.FIELD_META
|
||||
|
||||
---@class oil.sshUrl
|
||||
---@field scheme string
|
||||
---@field host string
|
||||
|
|
@ -96,7 +98,7 @@ end
|
|||
local ssh_columns = {}
|
||||
ssh_columns.permissions = {
|
||||
render = function(entry, conf)
|
||||
local meta = entry[FIELD.meta]
|
||||
local meta = entry[FIELD_META]
|
||||
return permissions.mode_to_str(meta.mode)
|
||||
end,
|
||||
|
||||
|
|
@ -105,7 +107,7 @@ ssh_columns.permissions = {
|
|||
end,
|
||||
|
||||
compare = function(entry, parsed_value)
|
||||
local meta = entry[FIELD.meta]
|
||||
local meta = entry[FIELD_META]
|
||||
if parsed_value and meta.mode then
|
||||
local mask = bit.lshift(1, 12) - 1
|
||||
local old_mode = bit.band(meta.mode, mask)
|
||||
|
|
@ -129,7 +131,7 @@ ssh_columns.permissions = {
|
|||
|
||||
ssh_columns.size = {
|
||||
render = function(entry, conf)
|
||||
local meta = entry[FIELD.meta]
|
||||
local meta = entry[FIELD_META]
|
||||
if not meta.size then
|
||||
return ""
|
||||
elseif meta.size >= 1e9 then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue