From: Charles O Nutter Date: 2006-08-02T03:43:05+09:00 Subject: Re: For performance, write it in C - Part 3, Source code now available ------=_Part_51851_9404978.1154457779948 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 8/1/06, Isaac Gouy wrote: > > iirc the Java program is shuffling around double byte unicode chars and > the C program is handling single byte chars. > Yes, that's one of the biggest problems with the code. The Java version uses all 16-bit UTF-16 character strings internally and then normalizes to the platform's preferred encoding (usually ISO-8859 or some variation of it). If you really want the prints (which you SHOULDN'T because benchmarking a numeric algorithm and including IO is bogus), then make the C version do the same amount of work...wide char strings and normalize to ASCII on write. -- Contribute to RubySpec! @ www.headius.com/rubyspec Charles Oliver Nutter @ headius.blogspot.com Ruby User @ ruby.mn JRuby Developer @ www.jruby.org Application Architect @ www.ventera.com ------=_Part_51851_9404978.1154457779948--