mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-14 03:32:00 +00:00
## About The Pull Request [Saves 0.2 seconds of init time. 50% of emissive blockers](8318b648f6) Emissive blockers are a decent expense during init, even these, which are the ones that update outside of initialize. I've inlined them, removed some redundant vars and checks, reduced the arg count, and shifted some things around. This ends up saving 200ms, or 50% of its total cost. I also shifted mutable_appearance about a bit. it's not a massive saving, but it is technically faster [Prevents a few redundant appearance_updates, saves 0.8 seconds of init](5475cd778b) Prequisit info: update_appearance is decently expensive It's good then to only do it if we have a reason to, right? Me and moth were shooting the shit about just general init time, and we came up with the idea of tracking which update_appearances actually "worked" and which didn't. That bit comes later, let's enjoy the fruits of that work first First, holograms were calling update_appearance on process, for almost no reason. I patched the one event they don't already "react" to, and then locked it behind a change decection if. good for live, doesn't impact init. Next, decals. If you add a decal to something before it inits, it'll react to the after successful init signal. The trouble is the same atom could have its appearance updated from this MORE then once, since decals can be stacked on tiles, and signal unregisters don't work once the signal is sent. So we add a flag to track if we've had this happen to us or not, so it only happens once. saves 80 ms Power! lots of things call power_change on init, often more then once. We'll update appearance for each of those calls, even if only one is an actual change. That's silly, better to track what sort of power we're using for our appearance and go off that changing This was taking about 300ms. Really stupid Icon smoothing. After emissive blockers were added, any change to something's icon smoothing would lead to an update_appearance call. Nasty shit, specially cause of walls, which don't even use emissive blockers. Ok then, so we'll always update appearance for movables, and will allow turfs that are interested to hook it manually. Not many of those anyhow This is slightly a dev ux thing, but it saves 600ms so I think it's worth it. Rare case anyway Telecomms: telecomm machines were updating appearance on process. This is to cover for them turning on/off on process. Better then to just check if on actually changed. This cost adds up midgame, doesn't impact init tho Materials: There's this update_appearance call in material on_apply. it doesn't do anything. The logs will lie to you and say it does, but it's just like reapplying emissives. It doesn't need to exist Saves like 50ms Canisters: Live thing, lots of time wasted updating appearance for no reason, lets see if we change anything first yes? [Uses defines to wrap update_appearance for tracking](4fa82e1c9d) [Undoes _update_appearance changes, instead reccomends 2 regexes to use](a8c8fec57a) I need file and line number for my tracking, so I need to override update_appearance calls, and also preferably not require every override of update_appearance to handle dummy file + line args. So instead, I created a wrapper proc that checks to see if appearanaces match (they're unique remember, the two of the same visual appearance will be equivalent) The trouble is I can't intercept JUST proc calls, or JUST function definitions with defines. it needs to be both. So I renamed the /update_appearance proc to /_update_appearance this way I can capture old uses, and don't need to worry about merge/dev brain skew ~~It does mean that all update_appearance proc definitions now look weird tho. My profiling is leaking into dev ux. I wish I had better templating.~~ **The above is no longer being pr'd**, it's instead just recommended via a few regexes adjacent to the define. Smelled wrong anyhow [Adds a setter for panel_open, so I can update_appearance on it](cf1df8a69f) ## Why It's Good For The Game Speed
143 lines
5.2 KiB
Plaintext
143 lines
5.2 KiB
Plaintext
//#define TESTING //By using the testing("message") proc you can create debug-feedback for people with this
|
|
//uncommented, but not visible in the release version)
|
|
|
|
//#define DATUMVAR_DEBUGGING_MODE //Enables the ability to cache datum vars and retrieve later for debugging which vars changed.
|
|
|
|
// Comment this out if you are debugging problems that might be obscured by custom error handling in world/Error
|
|
#ifdef DEBUG
|
|
#define USE_CUSTOM_ERROR_HANDLER
|
|
#endif
|
|
|
|
#ifdef TESTING
|
|
#define DATUMVAR_DEBUGGING_MODE
|
|
|
|
/// Enables update_appearance "relevence" tracking
|
|
/// This allows us to check which update_appearance procs are actually doing anything. Good thing to look in on once a year or so
|
|
/// You'll need to run a two regexes/search and replaces to make it work
|
|
/// First, one to convert type refs (PROC_REF.*)(update_appearance\)) -> $1_$2
|
|
/// Second, one to convert definitions /update_appearance\( -> /_update_appearance(
|
|
/// We'll use another define to convert uses of the proc over. That'll be all
|
|
// #define APPEARANCE_SUCCESS_TRACKING
|
|
|
|
///Used to find the sources of harddels, quite laggy, don't be surpised if it freezes your client for a good while
|
|
//#define REFERENCE_TRACKING
|
|
#ifdef REFERENCE_TRACKING
|
|
|
|
///Used for doing dry runs of the reference finder, to test for feature completeness
|
|
///Slightly slower, higher in memory. Just not optimal
|
|
//#define REFERENCE_TRACKING_DEBUG
|
|
|
|
///Run a lookup on things hard deleting by default.
|
|
//#define GC_FAILURE_HARD_LOOKUP
|
|
#ifdef GC_FAILURE_HARD_LOOKUP
|
|
///Don't stop when searching, go till you're totally done
|
|
#define FIND_REF_NO_CHECK_TICK
|
|
#endif //ifdef GC_FAILURE_HARD_LOOKUP
|
|
|
|
#endif //ifdef REFERENCE_TRACKING
|
|
|
|
/*
|
|
* Enables debug messages for every single reaction step. This is 1 message per 0.5s for a SINGLE reaction. Useful for tracking down bugs/asking me for help in the main reaction handiler (equilibrium.dm).
|
|
*
|
|
* * Requires TESTING to be defined to work.
|
|
*/
|
|
//#define REAGENTS_TESTING
|
|
|
|
// Displays static object lighting updates
|
|
// Also enables some debug vars on sslighting that can be used to modify
|
|
// How extensively we prune lighting corners to update
|
|
#define VISUALIZE_LIGHT_UPDATES
|
|
|
|
#define VISUALIZE_ACTIVE_TURFS //Highlights atmos active turfs in green
|
|
#define TRACK_MAX_SHARE //Allows max share tracking, for use in the atmos debugging ui
|
|
#endif //ifdef TESTING
|
|
|
|
/// If this is uncommented, we set up the ref tracker to be used in a live environment
|
|
/// And to log events to [log_dir]/harddels.log
|
|
//#define REFERENCE_DOING_IT_LIVE
|
|
#ifdef REFERENCE_DOING_IT_LIVE
|
|
// compile the backend
|
|
#define REFERENCE_TRACKING
|
|
// actually look for refs
|
|
#define GC_FAILURE_HARD_LOOKUP
|
|
#endif // REFERENCE_DOING_IT_LIVE
|
|
|
|
// If this is uncommented, we do a single run though of the game setup and tear down process with unit tests in between
|
|
// #define UNIT_TESTS
|
|
|
|
// If this is uncommented, will attempt to load and initialize prof.dll/libprof.so.
|
|
// We do not ship byond-tracy. Build it yourself here: https://github.com/mafemergency/byond-tracy/
|
|
// #define USE_BYOND_TRACY
|
|
|
|
// If defined, we will NOT defer asset generation till later in the game, and will instead do it all at once, during initiialize
|
|
//#define DO_NOT_DEFER_ASSETS
|
|
|
|
/// If this is uncommented, Autowiki will generate edits and shut down the server.
|
|
/// Prefer the autowiki build target instead.
|
|
// #define AUTOWIKI
|
|
|
|
/// If this is uncommented, will profile mapload atom initializations
|
|
// #define PROFILE_MAPLOAD_INIT_ATOM
|
|
|
|
/// If this is uncommented, force our verb processing into just the 2% of a tick
|
|
/// We normally reserve for it
|
|
/// NEVER run this on live, it's for simulating highpop only
|
|
// #define VERB_STRESS_TEST
|
|
|
|
#ifdef VERB_STRESS_TEST
|
|
/// Uncomment this to force all verbs to run into overtime all of the time
|
|
/// Essentially negating the reserve 2%
|
|
|
|
// #define FORCE_VERB_OVERTIME
|
|
#warn Hey brother, you're running in LAG MODE.
|
|
#warn IF YOU PUT THIS ON LIVE I WILL FIND YOU AND MAKE YOU WISH YOU WERE NEVE-
|
|
#endif
|
|
|
|
#ifndef PRELOAD_RSC //set to:
|
|
#define PRELOAD_RSC 2 // 0 to allow using external resources or on-demand behaviour;
|
|
#endif // 1 to use the default behaviour;
|
|
// 2 for preloading absolutely everything;
|
|
|
|
#ifdef LOWMEMORYMODE
|
|
#define FORCE_MAP "runtimestation"
|
|
#define FORCE_MAP_DIRECTORY "_maps"
|
|
#endif
|
|
|
|
//Additional code for the above flags.
|
|
#ifdef TESTING
|
|
#warn compiling in TESTING mode. testing() debug messages will be visible.
|
|
#endif
|
|
|
|
#ifdef CIBUILDING
|
|
#define UNIT_TESTS
|
|
#endif
|
|
|
|
#ifdef CITESTING
|
|
#define TESTING
|
|
#endif
|
|
|
|
#if defined(UNIT_TESTS)
|
|
//Hard del testing defines
|
|
#define REFERENCE_TRACKING
|
|
#define REFERENCE_TRACKING_DEBUG
|
|
#define FIND_REF_NO_CHECK_TICK
|
|
#define GC_FAILURE_HARD_LOOKUP
|
|
//Ensures all early assets can actually load early
|
|
#define DO_NOT_DEFER_ASSETS
|
|
#endif
|
|
|
|
#ifdef TGS
|
|
// TGS performs its own build of dm.exe, but includes a prepended TGS define.
|
|
#define CBT
|
|
#endif
|
|
|
|
// A reasonable number of maximum overlays an object needs
|
|
// If you think you need more, rethink it
|
|
#define MAX_ATOM_OVERLAYS 100
|
|
|
|
#if !defined(CBT) && !defined(SPACEMAN_DMM)
|
|
#warn Building with Dream Maker is no longer supported and will result in errors.
|
|
#warn In order to build, run BUILD.bat in the root directory.
|
|
#warn Consider switching to VSCode editor instead, where you can press Ctrl+Shift+B to build.
|
|
#endif
|