http icon indicating copy to clipboard operation
http copied to clipboard

format-date is slow

Open waywardmonkeys opened this issue 11 years ago • 3 comments

format-date from the system library is slow. This is used for the response's date header, and in the logging code.

One issue here is that since that method is defined to take <string>, there is a lot of generic dispatch including each of the character comparisons.

An easy (but not really correct) fix is to have it take a <byte-string> for the format parameter and have date-stream be a <byte-string-stream> and give it a <byte-string> as the contents.

waywardmonkeys avatar Jan 19 '14 09:01 waywardmonkeys

What happened to copy-down methods? I thought that was one of the major features Open Dylan has but Gwydion doesn't?

It would also be completely correct, and faster than what you have now, to do let format = as(<unicode-string>, format) at the start of the method. That's a single GF dispatch, which having multiple copy-down methods instead of a single method would also require.

It's not clear to me from http://opendylan.org/documentation/library-reference/system/date.html whether <date> is sealed.

brucehoult avatar Jan 19 '14 10:01 brucehoult

copy down methods are probably one way to resolve this. (And for the record, copy down methods were added to the unreleased Gwydion Dylan 2.5).

It would take a minor bit of restructuring to make that work so that we can eliminate the dispatch on the temporary string stream as well. (Hopefully...)

waywardmonkeys avatar Jan 19 '14 10:01 waywardmonkeys

https://github.com/dylan-lang/opendylan/pull/650 is a start on addressing this.

waywardmonkeys avatar Jan 21 '14 14:01 waywardmonkeys