Native codegen works in localscripts in studio, but not in the client

PC Info: Windows 11 22621.2506 Intel Core I3-10100F
Date First Experienced: 04/11/2023
Date Last Experienced: 15/11/2023
Reproduction steps:

  1. Create 2 local scripts in starterplayerscripts
  2. Add a benchmark to both
    Example:
wait(5) -- Let the game load first (use a different time for each script to be sure they don't skew the other's results)
local t = 0
local startTime = os.clock()
for i =1, 1000000000, 1 do
	t += 1
end
print(t, os.clock()-startTime)
  1. Add --!native to the start of one of the scripts
  2. Compare the times between them

In studio, the native script will run faster, but in the client, they’ll take around the same time
I am not sure if local scripts are supposed to be able use native codegen, or if they aren’t if it’s planned for the future, but there shouldn’t be a discrepancy between the client and studio

Example game: Bedu009's Place Number: 89 - Roblox

Per the Luau Native Codegen Preview announcement, the native codegen preview feature is currently only usable in Roblox Studio. Scripts running on the server or client are not natively compiled.

Note also from the announcement post: “We do expect that initially we will not support native code generation on clients (desktop or mobile) - so the first full release of this feature will be restricted to Studio and server-side scripts. That may change in a future far away, as on the clients we need to balance many complex competing factors that make native codegen much more difficult.”

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