Live data from Hacker News

Cheerp – A C/C++ compiler for web applications

leaningtech.com

41–50 of 54 posts

Re: Cheerp – A C/C++ compiler for web applications

#41
I'm a bit puzzled by the rebranding. First of all, the logo and the name sound a bit similar to Twitter. And I'm not sure what bird noises have to do with a compiler?

The previous name, Duetto, made sense to me, since they compile to both client and server, so it's like two things running in harmony, which is a duet in music.

Re: Cheerp – A C/C++ compiler for web applications

#42

If anyone from Cheerp reads this, I use emscripten ( https://github.com/kripken/emscripten ) at the moment, is Cheerp any better ? Specifically does it compile faster, generates a smaller final .js output, or produce "faster" code ?

The Emscripten author wrote a blog post when Cheerp (then called duetto) was first announced: http://mozakai.blogspot.co.uk/2013/11/c-to-javascript-emscri...

As far as I know that comparison is still up to date, but if the Cheerp devs are here maybe they can comment.

I may do a followup post now, since Cheerp is at 1.0. Seems like a good time to do some benchmarking.

Re: Cheerp – A C/C++ compiler for web applications

#43
post #36

Earlier quoted context omitted.

I was replying to the statement: "For example, people also write C++ when correctness is critical". And I say if someone writes C++ in a correctness critical system, he must not know what he is doing. Even if you're using only STL, RAII and following all the good coding practices, there are still so many ways to screw things up, that C++ is among the worst choices in this regard.

Nasa and military don't know what they're doing? C++ is the go to language in mission critical systems.

NASA and military are using a whole lot of different technologies and languages, including, but not limited to assembly, C, C++, ADA, Haskell, Coq, Python and Java. Saying they use C++ for correctness, when they are using Coq or Haskell as well, is again - exaggeration. I believe they use C/C++ more for performance / low memory overhead rather than its correctness related features.

Re: Cheerp – A C/C++ compiler for web applications

#44
post #39

"Cheerp compiles to native binary code backend, JavaScript frontend, and automatically generates RPC communication code" The RPC feature sounds like it could be immensely useful for day-to-day web development. But the C/C++ is a deal-breaker for most web developers. Are there any projects that only do the RPC autogeneration stuff? Also can frontend/backend code be shared (if there are no dependencies to the browser/u…

Yes, code without client- or server-specific dependencies can be shared.

Re: Cheerp – A C/C++ compiler for web applications

#45
post #21

If anyone from Cheerp reads this, I use emscripten ( https://github.com/kripken/emscripten ) at the moment, is Cheerp any better ? Specifically does it compile faster, generates a smaller final .js output, or produce "faster" code ?

I just ran the HelloClient.cpp from their example page [1] and the compiled file was 1.7 Mb [1] http://www.leaningtech.com/cheerp/examples/

Even if js files are usually delivered compressd by gzip (which is very effective on unminimized js files), we are aware of the issue and we are working on reducing output size.

An integrated code minimizer is in the pipeline for release 1.1, and for the medium term we are working on an optimizer which cuts away unneeded libc++ initialization, which is preventing the dead code eliminator from pruning the non-useful libc++ code (which is a great part of that 1.7Mb).

So, expect big improvements in this area!

Disclaimer: I am one of Leaning Technologies founders.

Re: Cheerp – A C/C++ compiler for web applications

#48
post #16

This is somewhat off-topic but they turned user-scalability off, making it impossible to zoom out (of the pre-zoomed in) mobile site. Other than that, it's an interesting proposition and I look forward to trying it out.

Thanks for the report, we have fixed that issue today.

Re: Cheerp – A C/C++ compiler for web applications

#49

Earlier quoted context omitted.

> People mostly write with C++ when performance is critical. Performance is a big reason people use C++, but there are many others. For example, people also write C++ when correctness is critical (bank software, safety-critical systems, etc.).

Writing for correctness in a language with no memory-safety, weak type system and, till not very long ago, no standardized memory-model, and UB in every other paragraph of the specs? Good joke. If they are really doing this, they have no idea what they are doing. There are plenty of languages better for safety-critical systems than C++; even widely hated, boring Java is much better.

It's a bit off topic, but I'm being descriptive (based on professional experience) and not normative when I say C++ (and C and Ada) are used for safety-critical software. Javascript and functional languages certainly aren't.

The vagaries of the standard aren't issues since safety critical software is validated on a per-platform and per-compiler basis. Memory safety is certainly a concern during the development process but more importantly (!) GC languages (like javascript and Scala) do not have provably (for some value of provably) deterministic execution times. Determinism is also a problem for lazy languages (like Haskell).

I say that to say the zero-cost abstractions of C++ is a huge benefit when writing safety-critical software. The level of control over emitted binaries is essential and fairly rare in programming languages.

> If they are really doing this, they have no idea what they are doing.

Well, I can't speak for entire industries, but that's a pretty sweeping generalization. You might be surprised what the challenges are when writing safety-critical systems software. That being said, I'm sure large portions of the industry are ripe for innovation.

Re: Cheerp – A C/C++ compiler for web applications

#50

Interesting although if you want massive performance on a web application i'd probably vie for erlang unless you're doing something computationally complex on the backend. It would be nice to be able to write code once and use in multiple places but theres often so much extra work involved in that, that for many applications it makes more sense to just use interfaces etc. Neat project either way.

If you want massive performance, you most likely want to avoid erlang; if you want massive scalability, erlang might very well be a great fit. I think it's quite different.

Performance in terms of request throughput you can serve per minute for some given set of CPU and RAM.

Erlang processing is slower than C by quite a bit but the reduced threading costs tends to make up for it when you are in a scenario where you need to serve multiple requests simultaneously.

On an apples to apples comparison well written C is going to beat erlang on this every time but once you start getting into threading, mutex locks etc. the equation starts to shift more towards Erlang favor _as long_ as each request you are serving is not highly computational in nature and would involve semaphores, and so on for thread management in c.

Post reply on HN