4k+ lines of code for a couple lists in a module, is it ok if it is just to use as a data base or is it bad for performance?

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!

I am just trying to figure out if this is bad in terms of performance.

  1. What is the issue? Include screenshots / videos if possible!

I have many lines of codes due to my programming style and also due to me creating a sort of data base to utilize. This is my second post after making a category mistake, so if I did something wrong with the post still, I would appreciate feedback to improve my ability to make a solid topic for discussion.

image

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

I was looking for something about having many lines of codes, but for a specific case, but did not find any on the case that I was curious about, I did find stuff about many lines of codes, but they didn’t really answer my question as I am not sure if the answer would vary with this situation.

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

I have two lists one for first names and one for last names and each has 2k lines each with 1000 spaces between each line and 1000 actual lines of codes.

-- This is an example Lua code block

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

Lines of code is not an appropiate metric if you dont show the structure of your tables.
What is a problem though; are those horrendous variable names, “mod” i can understand, but “firNam”, “lastNam” ???

could you show example data structure and how many setasync requests are being made per player

The structure of firNam is the same as the structure of lasNam (Added open structure of table). What is wrong with my variable names btw? I always do the first 3 letters of each word if their are only two words for the variable, but if it is greater than two words I do a the first letter of each word as a capital letter and then put a comment above it to explain each capital letter.

I don’t believe I am using any setasync requests for any players atm, so I don’t think that applies, as for the data structure, I have added a more in depth screen shot.

Many experiences on roblox use modules and tables unless you are looping through hundreds of table values every second you should be good

you could also assign metadata to those values like this

["Names"] = {
 ["Omar"] = {
    Clothing = {Shirt = 0, Pants = 0}
  }
}

you could also use folders and values instead of module

i believe folders and values will be less performant than modules

they both are easily accessible and easy to use

i did some speed testing and instance lookup is actually 333 microseconds faster than table lookup

--0.0000057220458984375 instance lookup 
--0.0003390312194824219 table lookup

this is example structure i would imagine if instances were used

image

What code you wrote to make this lookup benchmark?

1 Like

Prefer storing static data lists like names in a module script (or multiple module scripts) instead of using values.

It’s significantly more easier to modify reuse etc if it’s in the code

Can you show your benchmark code?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.