You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 4126 Reporter: MIchaelWohlwend Status: closed (set by @xavierleroy on 2006-10-09T13:08:12Z) Resolution: not a bug Priority: normal Severity: tweak Version: 3.09.1 Category: ~DO NOT USE (was: OCaml general) Monitored by: MIchaelWohlwend
Bug description
while looking over the code I realized that in byterun/str.c the function caml_string_compare could be a little optimized, by moving the memcmp after the comparing of the length, the comparing of len1 and len2 for memcmp ins't neccesary anymore.
Maybe string-compares go even faster than now :-)
If I understand correctly the proposed patch, it would result in "zzz"
being less than "aaaa", which is not what we want (i.e. lexicographic
ordering).
Original bug ID: 4126
Reporter: MIchaelWohlwend
Status: closed (set by @xavierleroy on 2006-10-09T13:08:12Z)
Resolution: not a bug
Priority: normal
Severity: tweak
Version: 3.09.1
Category: ~DO NOT USE (was: OCaml general)
Monitored by: MIchaelWohlwend
Bug description
while looking over the code I realized that in byterun/str.c the function caml_string_compare could be a little optimized, by moving the memcmp after the comparing of the length, the comparing of len1 and len2 for memcmp ins't neccesary anymore.
Maybe string-compares go even faster than now :-)
Here is my patch:
len1 = caml_string_length(s1);
len2 = caml_string_length(s2);
if (len1 < len2) return Val_int(-1);
if (len1 > len2) return Val_int(1);
return Val_int(0);
}
The text was updated successfully, but these errors were encountered: