Obsessive Coding Disorder, Julian Storer - JUCE Summit keynote 2015
Video Statistics and Information
Channel: JUCE
Views: 11,698
Rating: undefined out of 5
Keywords: JUCE, Julian Storer, Zlib, C++, JUCE Summit, Coding standards, Compression
Id: SIAAvv1O7Gg
Channel Id: undefined
Length: 42min 54sec (2574 seconds)
Published: Wed Feb 10 2016
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.
Would love to have the code and run it through a profiler. That use of an exception to replace a goto in the state machine is a bit nasty though. Using goto for that is completely legitimate even in modern C++.
The inlining issues could probably be solved with functors instead of a macro mapped to compiler specific extensions. Functors taking parameters by reference are almost always inlined.
Great presentation, thanks for posting!
I really think that, while it is definitely possible to write awful unreadable and complex C++, modern C++ makes it easier to come up with simple, elegant, readable code that still performs well.
This is why I don't buy the argument that C is simpler and easier to reason about than C++. No, look at zlib. It is in no way alone, many popular libraries have similar code bases.
The presentation was put together very well.
Very nice. Couldn't agree more with turning this into a header file instead of ten objects with autotools and a complex build system.
I had no need for the compression portion, so I took out the core decompression alone and got that down to 7.8KB at 336 lines of code. Then I factored out ZIP, GZIP and PNG support to other small headers that build on it. But I didn't really take the time to master the intricacies of inflate, and instead it's very much the original C code wrapped inside C++ still.
That was great.
License, Copyright? I'm intrigued. About what he says around 36:33, is that true?
He discusses the copyright of the resulting code. He says if he refactors enough so that there is no original code left, the code is his. Is that right? Refactoring some code can make the result not a derivative work?
I was not aware of zlib having dependencies in the first place?
Fun and interesting presentation, but I also see the portability of older platforms as one of the old code's strengths. This refactoring would likely abandon support of those platforms.
Very good talk. In the C++ code the columnar formatting is a bit too much obsessive, and I think some C++ lines are too much long.
Now I'd like to see the C++ code ported to Rust, to see if the performance changes, and how the very strict Rust language leads the code and the programmer :)
Edit: to produce a sufficiently efficient binary from the C code it suffices a faster, less optimizing, simple(r) compiler (like http://bellard.org/tcc/ ), while to do the same from the C++ code you probably need a more optimizing (and more complex) compiler to remove the abstractions (like the lambdas), and probably more RAM to compile the C++ code.
Edit: many of his improvements are possible even if you don't leave C99/C11.