Rewriting in C++ for Fun, Speed and Masochism

J

Jorgen Grahn

Rewriting in C++ for Fun, Speed and Masochism:
http://petersobot.com/blog/rewriting-in-cpp-for-fun-speed-and-masochism/

Interesting little article on rewriting an app
in C++ from Ruby. Sped up 50X but the errors
in the library libjpeg were killing him.

The real conclusion is this one further down, I think. He switched
again from libjpeg to another library and then:

When given the right amount of abstraction - in this case, a fast
C++ library - writing the code to be adequately fast was trivial.
Using old-school C-style library integration, on the other hand,
ended with me wasting hours making little to no progress.

Not that personally believe this is the core of the choice between
Python/Ruby/etc and C++. I want the static typing, for better
maintainability of larger programs.

/Jorgen
 
J

Juha Nieminen

Jorgen Grahn said:
The real conclusion is this one further down, I think. He switched
again from libjpeg to another library and then:

When given the right amount of abstraction - in this case, a fast
C++ library - writing the code to be adequately fast was trivial.
Using old-school C-style library integration, on the other hand,
ended with me wasting hours making little to no progress.

libjpeg is one of the most horrendously designed libraries in existence
(even by the typical standards of C libraries). The sad thing about it
is that it's the "standard" library for jpeg support...

It could have been made much, much better. As an example of a similar
C library that's actually quite well designed, take libz. Especially
if you are compressing to or decompressing from a file, its usage is
laughably simple (basically, if you know how to use C I/O functions,
you know how to use libz).

(If you are (de)compressing from memory to memory it's a bit more involved,
but not a lot.)

In contrast, libjpeg is horrendous and really complicated to use.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top