Skip to content

Commit 1925138

Browse files
authored
Disable time tracking in wasm release builds because it's expensive (#99841)
Right now on main we spend a good chunk of cpu time just calling _emscripten_get_now in order to measure how long interpreter code generation takes. On most targets the equivalent timestamp checks are fast but on wasm, they're not. So this PR disables those checks in wasm release builds specifically. Based on my measurements this should improve startup time a little bit.
1 parent 8448925 commit 1925138

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/mono/mono/mini/mini.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2811,12 +2811,20 @@ void mono_cfg_add_try_hole (MonoCompile *cfg, MonoExceptionClause *clause, guint
28112811
void mono_cfg_set_exception (MonoCompile *cfg, MonoExceptionType type);
28122812
void mono_cfg_set_exception_invalid_program (MonoCompile *cfg, const char *msg);
28132813

2814+
#if defined(HOST_WASM)
2815+
#define MONO_TIME_TRACK(a, phase) \
2816+
{ \
2817+
(phase) ; \
2818+
a = 0; \
2819+
}
2820+
#else
28142821
#define MONO_TIME_TRACK(a, phase) \
28152822
{ \
28162823
gint64 start = mono_time_track_start (); \
28172824
(phase) ; \
28182825
mono_time_track_end (&(a), start); \
28192826
}
2827+
#endif // HOST_WASM
28202828

28212829
gint64 mono_time_track_start (void);
28222830
void mono_time_track_end (gint64 *time, gint64 start);

0 commit comments

Comments
 (0)