Skip to content

Cache glab env configuration to avoid reading from FileSystem everytime

Created by: pgollangi

Possibly there are fetching of multiple glab env variables per a command execution which always reads from FileSystem will lead to delay in commnad execution especially on HDD

Description Current Benchmark results of internal/config/file.GetKeyValueInFile are

BenchmarkGetEnv-4   	   50974	     23479 ns/op	     816 B/op	       6 allocs/op
BenchmarkGetEnv-4   	   51392	     23192 ns/op	     816 B/op	       6 allocs/op
BenchmarkGetEnv-4   	   51847	     24126 ns/op	     816 B/op	       6 allocs/op
BenchmarkGetEnv-4   	   51861	     23541 ns/op	     816 B/op	       6 allocs/op
BenchmarkGetEnv-4   	   51854	     23891 ns/op	     816 B/op	       6 allocs/op

Expected Behavior Possible Fix It can be reduced by caching glab on first FS read.

Steps to Reproduce PR #145 demonstrates the benckmark

Your Environment

  • Version used: latest
  • Operating System and version: Windows 10
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information