[web-devel] FilePath in WAI

Bulat Ziganshin bulat.ziganshin at gmail.com
Sat Jun 16 15:09:41 CEST 2012


Hello Vagif,

Saturday, June 16, 2012, 2:00:14 AM, you wrote:

1. Currently, filenames are stored as String requiring serializaton to
UTF-16 on Windows and (usually) to UTF-8 on Unixes. With Filename=ByteString
it will be `id` on Unixes and utf-to-utf conversion on Windows.
Actually, it will became much faster on BOTH platforms

2. System calls usually have such large overhead than even conversion from
String doesn't have any srious impact on performance. For example, i
can open about 10k files/sec and find about 100k files/sec

3. The real difference will be, though, in the operations involving
filenames but not requiring system calls. For example, file caching

4. We don't need only to store filenames, but to perform various
operations on them. So it's probably better to store filenames in
efficient and easy to operation way, leaving all conversions to
syscall-shells. since from the user perspective filenames are just
strings, the String or Text type looks like the best fit

5. Making its own file manipulation library for the needs of web
servers looks like too expensive solution. If we really need this
faster library, it may be proposed as general purpose Haskell library

6. Ideally, we should have Unix/Windows/...-specific libraries dealing
with files using native filename representation and higher-level
universal library, hiding OS differences and in particular converting
native filenames from/to String and Text filename representation



> Considering that we are talking about the web server, it would be safe to
> assume that most people would not run it on windows for production use.

> So i say WAI should switch to ByteString, and let the windows users be
> penalized just a little bit. You can't please everyone.

> On Friday, June 15, 2012 02:47:15 PM Johan Tibell wrote:
>> On Fri, Jun 15, 2012 at 2:41 PM, Greg Weber <greg at gregweber.info> wrote:
>> > The ticket would be to switch the standard libraries to use
>> > system-filepath, which probably requires a mailing list discussion
>> > somewhere, a lot of boring changes of code, and a more inconvenient
>> > API for end users. I will wait for Text to become standardized first
>> > 
>> > :)
>> 
>> The FilePath issue has been discussed at length before. The problem is
>> that different OS:es define file paths to be different things (i.e.
>> Unicode or bytes.) The FilePath type somehow has to bridge that, that
>> will be difficult. My main grip with FilePath right now is that it's
>> not an abstract type.
>> 
>> -- Johan
>> 
>> _______________________________________________
>> web-devel mailing list
>> web-devel at haskell.org
>> http://www.haskell.org/mailman/listinfo/web-devel

> _______________________________________________
> web-devel mailing list
> web-devel at haskell.org
> http://www.haskell.org/mailman/listinfo/web-devel


-- 
Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com




More information about the Libraries mailing list