dylan-lang / http

HTTP server and client for Dylan
https://opendylan.org/package/http
MIT License
22 stars 11 forks source link

format-date is slow #29

Open waywardmonkeys opened 10 years ago

waywardmonkeys commented 10 years ago

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.

brucehoult commented 10 years ago

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.

waywardmonkeys commented 10 years ago

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 commented 10 years ago

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