Some FreeBSD performance Issues

2007-11-08 Thread Randall Hyde
Hi All, I recently ported my HLA (High Level Assembler) compiler to FreeBSD and, along with it, the HLA Standard Library. I have a performance-related question concerning file I/O. It appears that character-at-a-time file I/O is *exceptionally* slow. Yes, I realize that when processing large file

Re: Some FreeBSD performance Issues

2007-11-08 Thread Dan Nelson
In the last episode (Nov 08), Randall Hyde said: > It appears that character-at-a-time file I/O is *exceptionally* slow. > Yes, I realize that when processing large files I really ought to be > doing block/buffered I/O to get the best performance, but for certain > library routines I've written it'

Re: Some FreeBSD performance Issues

2007-11-08 Thread Tim Kientzle
Dan Nelson wrote: In the last episode (Nov 08), Randall Hyde said: It appears that character-at-a-time file I/O is *exceptionally* slow. ... reasonable, though not stellar, performance under Windows and Linux. However, with the port to FreeBSD I'm seeing a three-orders-of-magnitude performance

Re: Some FreeBSD performance Issues

2007-11-09 Thread Dinesh Nair
On Thu, 8 Nov 2007 16:52:38 -0600, Dan Nelson wrote: > In the last episode (Nov 08), Randall Hyde said: > > It appears that character-at-a-time file I/O is *exceptionally* slow. > > Yes, I realize that when processing large files I really ought to be > > doing block/buffered I/O to get the best pe

Re: Some FreeBSD performance Issues

2007-11-09 Thread Randall Hyde
> > You should also carefully do an strace or similar on > Windows and Linux as well. You may find that you're > doing a system call per byte on FreeBSD but not on > those other systems. Certainly this might be possible under Windows, as I have no idea what happens once I link in one of the vari

Re: Some FreeBSD performance Issues

2007-11-10 Thread Peter Jeremy
On Fri, Nov 09, 2007 at 08:36:32AM -0800, Randall Hyde wrote: >To answer a different question in the thread, I'm pretty sure I'm making >only one FreeBSD call per byte, at least in one of the cases I posted. How about using ktrace or similar to confirm this. >I wonder if I'm only getting one char

Re: Some FreeBSD performance Issues

2007-11-11 Thread Randall Hyde
Hi All, Well, I've done some sleuthing and discovered some issues. First, the "dd" command produced approximately the same results everyone else was getting. So I rewrote a version of my test code in C using the stdlib "read" call and it had really great performance. Not understanding why C's cod

Re: Some FreeBSD performance Issues

2007-11-12 Thread Adrian Chadd
On 12/11/2007, Randall Hyde <[EMAIL PROTECTED]> wrote: > At this point I'm not sure why FreeBSD's API call is so slow (btw, it's not > the system call that's responsible, if I make several additional API calls > on each read, e.g., doing lseeks, this has only a marginal impact on > performance). B

Re: Some FreeBSD performance Issues

2007-11-12 Thread Peter Jeremy
On Sun, Nov 11, 2007 at 09:52:21AM -0800, Randall Hyde wrote: >why C's code was so much faster, I dug into the source code and discovered >that open/read/write/etc. use *buffered* I/O (which explains why "dd" >performs so well). open/read/write/etc. do _not_ do any buffering in userland. This is

Re: Some FreeBSD performance Issues

2007-11-12 Thread Benjamin Lutz
Randall Hyde wrote: > Hi All, > > I recently ported my HLA (High Level Assembler) compiler to FreeBSD and, > along with it, the HLA Standard Library. I have a performance-related > question concerning file I/O. > > It appears that character-at-a-time file I/O is *exceptionally* slow. Yes, I > rea

Re: Some FreeBSD performance Issues

2007-11-12 Thread Randall Hyde
> > > Hello Randy, > > First, let me out myself as a fan of yours. It was your book that got me > started on ASM and taught me a lot about computers and logic, plus it > provided some entertainment and mental sustenance in pretty boring > times, so thanks! > > Now, as for your problem: I think I h