stan-dev / stanc3

The Stan transpiler (from Stan to C++ and beyond).
BSD 3-Clause "New" or "Revised" License
138 stars 44 forks source link

SoA optimization can over-promote objects used inside loops to produce slower code #1280

Open WardBrian opened 1 year ago

WardBrian commented 1 year ago

Current Behavior:

See this forum thread by @mike-lawrence which contains an example that is ~5x slower at --O1 compared to the default.

Expected Behavior:

SoA optimization should not promote things being assigned to inside of a tight for loop