lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi,

On 17-03-2017 23:24, Sean Conner wrote:

(Thanks for sharing your thoughts)

It was thus said that the Great Hakki Dogusan once stated:
Hi,

For a production system, I'm using Lua table for stock definitions.

Each table consists of something like:
--
local T = {
  some fields..,
  colors = { some fields.., prices = {}, }
}
return T
--

I've created one file for each T.
There are ~9000 files.
During a production session, each process will be use
200-300 of them (may not be same set).

I'm seeking your opinions about usage:
- Load all at startup, put them in "Defs" table

  Even if you have tons of memory, I would not load all during startup
unless loading during operation takes too long for what you are doing
(masure measure measure).


I was looking from "usability" angle, but you're right, my message smells like "optimisation" question :-)


- Load only when needed (ie.let OS handle caching)

  I would go with this.  Modern Unix systems tend to use any free memory as
a file cache anyway.


Initial experiments show that using this method is ok.
If needed, I'll apply "load and store" later.


- Load when needed and store in "Defs" table

  Again, this depends upon your useage.  If a data file is loaded more than
once, then this is a good thing to do; otherwise, if it's only used once, it
may just waste some memory.  This depends upon your usage of the data.

  -spc





--
Regards,
Hakki Dogusan