Re:How to Write Portable C Without Complicating Your Build
by inferiorhuman on Friday March 31, 2017 @03:55PM
(#14007533)
Rust is pretty nice if a bit rough with the cross compilation stuff. The big problem is speed. Compiling rust projects takes a while and some operations like reading a file line b line are absolutely glacial.
[ Parent
| on HN ]
Re:How to Write Portable C Without Complicating Your Build
by steveklabnik on Friday March 31, 2017 @04:16PM
(#14007742)
Are you using a BufReader for those file reads? If not, system calls will slow you way down.
Re:How to Write Portable C Without Complicating Your Build
by inferiorhuman on Saturday April 01, 2017 @09:01PM
(#14015096)
Yep. And it's something of a known issue. Using BufReader#lines is glacial (and something of a known issue) in debug mode and merely slow in release mode. My understanding is that the BufReader is allocating a new String object for each line and so you're dealing with strict UTF-8 parsing and memory allocation.
My use case here is reading Vyatta config files. So lots of files that are generally (but not always) short. Mostly it's a fun teach myself Rust project, and it's hit lots of interesting edge cases in Rust, but otherwise I'd be all over just writing it in Python or Ruby.
Re:How to Write Portable C Without Complicating Your Build
by steveklabnik on Saturday April 01, 2017 @10:26PM
(#14015415)
Interesting, I did not know this.
Re:How to Write Portable C Without Complicating Your Build
by inferiorhuman on Monday April 03, 2017 @10:03PM
(#14028965)