Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and
privacy statement. We’ll occasionally send you account related emails.
Already on GitHub?
to your account
Original bug ID: 6577
Assigned to: @alainfrisch
Status: closed (set by @xavierleroy on 2016-12-07T10:34:53Z)
Target version: 4.03.0+dev / +beta1
Fixed in version: 4.03.0+dev / +beta1
Category: standard library
My intuition was that with the new compile-time based implementation of format strings the following two lines would run at approximately the same speed:
ignore (Printf.sprintf "%Ld" x);
ignore (Printf.sprintf "%s" (Int64.to_string x));
However, some micro-benchmark indicates that the first one is about 33% slower than the second one. Same kind of observation for %ld, but not for %d.
This is not a big deal, but maybe some simple shortcuts for common boxed integer format specifiers could bring some non-negligible speedup.
I assume the performance hit comes from CamlinternalFormat.format_of_aconv. I'd try to specialize it to the three use cases (l, L, n) and always returns string literals, as format_of_iconv.
The text was updated successfully, but these errors were encountered:
Comment author: @alainfrisch
Fixed by commit 15319 on trunk. Also addressed performance of %S and %C in the two commits after that one.
Sorry, something went wrong.
No branches or pull requests