Choosing script threads?

I have a very specific question. When you open the micro profiler pause and view the things happening. You can see a tone of threads that the script can run on. My question is, can you chose witch thread said code should run on ?

1 Like

If you want to play around with using multiple threads to run code, I would read about Parallel Luau. It’s a handy tool.

1 Like

I have already looked around that area and understand it well because I watched suphi kaner’s tutorial on it. I was questioning if there was a way to choose a specific thread. like not have it random like it seems to currently be.

1 Like

With actors, you should be able to split a tasks into multiple threads. You would just use that specific actor. However, it does load balance tasks. Since not every cpu will have the same number of cores, more actors than cores means it will split tasks into a set number of threads.

I’m not entirely sure it’s possible to select a specific thread to run your code on, but if you want to improve performance, using parallel luau as is would be your best bet

What situation would you need it to run on a specific thread?

1 Like

may sound crazy, but I have put together a 3D wireframe renderer using editable images but the problem is after about 500 objects the fps Tanks to ~10, The reason I created this was because I also saw a GPU thread all the way at the top of the profiler. and that’s why I wanted to see if I was able to choose it.

1 Like

The micro profiler shows everything, even threads we don’t have access to. So it’s impossible to program stuff for the gpu

Do you know what is causing the lag with your 3D wireframe renderer? If the lag is caused by updating properties of objects, or doing other stuff that cannot be ran in parallel parallel lua wont be very useful

1 Like

I would assume its just the sheer amount of lines that I have to draw every frame that is slowing my renderer down. I just wanted to know if there was a way to chose a thread.

Thanks for the help :smiley:

2 Likes

You might want to try using this method instead of calling DrawLine 6000 times


With a lower amount of cubes, it will definitely be much slower, but it shouldn’t get much slower the more cubes you add. It will require some math to calculate the pixels though

I’m not drawing boxes or to the pixels individually at all. I am using the:DrawLine() function so I can render things at the fastest rate I can. It works way better than drawing the pixels manually

Have you tested it?
Calling roblox functions, or changing object’s properties isn’t that fast, which is why I am thinking it might be faster (when there are a lot of objects) to calculate the pixels directly in “pure” lua (doing math in lua is fast), and calling :WritePixels.
Using WritePixels will surely be a lot slower than DrawLine in normal scenes, but it has the potential to not slow down significantly as more objects are added, as opposed to DrawLine

Its not the lines themselves its the objects in the scene. Aka cubes looping through 500+ cubes while also drawing 12 lines each time can lead to a pretty large number of calculations that need to be done.
although I did notice a small thing that I really want to stop witch is anti aliasing on the lines. that’s just a small bit annoying so I will eventually write my own line renderer.

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