Use String#delete_prefix to reduce object allocations and simplify the existing logic that converts a file path to a class name when loading candidate models during startup. Also, move repeated path creation to respective outer loop to further cut back on string objects.
Coverage: 95.886% (-0.001%) from 95.887% when pulling 81f5377772fa3e655de672bea92fd66b789e5ce0 on bnix:master into fa9a96bb12f07da349c0c2884a30a4f207991e4b on railsadminteam:master.
Use
String#delete_prefix
to reduce object allocations and simplify the existing logic that converts a file path to a class name when loading candidate models during startup. Also, move repeated path creation to respective outer loop to further cut back on string objects.Profiler setup on a small project
Original code:
After patch: