Hi, Nice profile-driven debugging :)
On Tue 22 Jun 2010 21:40, l...@gnu.org (Ludovic Courtès) writes: > @@ -1168,6 +1168,21 @@ SCM_DEFINE (scm_string_eq, "string=", 2, 4, 0, > "value otherwise.") > #define FUNC_NAME s_scm_string_eq > { > + if (SCM_LIKELY (scm_i_is_narrow_string (s1) == scm_i_is_narrow_string (s2) > + && SCM_UNBNDP (start1) && SCM_UNBNDP (end1) > + && SCM_UNBNDP (start2) && SCM_UNBNDP (end2))) > + { > + size_t len1, len2; > + > + len1 = scm_i_string_length (s1); > + len2 = scm_i_string_length (s2); > + > + if (SCM_LIKELY (len1 == len2)) > + return scm_from_bool (memcmp (scm_i_string_chars (s1), > + scm_i_string_chars (s2), > + len1) == 0); > + } > + Nasty, but OK I guess if you need it. Why not also add a fast path for scm_is_eq (s1, s2), or for comparing stringbufs, or something ? > It’s quite inelegant, but it leads to a more balanced profile: > > samples % symbol name > 8079 23.3984 scm_string_eq > 5649 16.3606 vm_debug_engine > 5624 16.2882 scm_i_str2symbol ^ What is this doing here? And for the matter, what are the rest about? Did you just do a really short profile? > 2840 8.2252 scm_ihashq > 1755 5.0828 scm_i_string_hash > 1637 4.7411 scm_fluid_ref > 1027 2.9744 scm_i_string_ref > 1011 2.9281 scm_hash_fn_get_handle > 877 2.5400 scm_i_string_chars > 793 2.2967 scm_module_variable > 553 1.6016 scm_from_locale_stringn > 471 1.3641 scm_from_stringn > 426 1.2338 scm_sym2var > 384 1.1121 scm_i_make_string > 317 0.9181 scm_module_lookup Andy -- http://wingolog.org/